Top Fields Constructors Methods
org.apache.hc.client5.http.impl.nio

pack-priv final Class DefaultManagedAsyncClientConnection

extends Object
implements ManagedAsyncClientConnection, Identifiable
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.util.Identifiable, org.apache.hc.client5.http.nio.ManagedAsyncClientConnection, org.apache.hc.core5.reactor.ssl.TransportSecurityLayer, org.apache.hc.core5.http.HttpConnection, org.apache.hc.core5.http.SocketModalCloseable, org.apache.hc.core5.io.ModalCloseable, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.net.SocketAddress, java.util.concurrent.atomic.AtomicBoolean, javax.net.ssl.SSLContext, .SSLSession, org.apache.hc.client5.http.nio.ManagedAsyncClientConnection, org.apache.hc.core5.concurrent.FutureCallback, org.apache.hc.core5.http.EndpointDetails, .HttpConnection, .HttpVersion, .ProtocolVersion, org.apache.hc.core5.http.nio.command.ShutdownCommand, org.apache.hc.core5.io.CloseMode, org.apache.hc.core5.net.NamedEndpoint, org.apache.hc.core5.reactor.Command, .IOEventHandler, .IOSession, .ProtocolIOSession, org.apache.hc.core5.reactor.ssl.SSLBufferMode, .SSLSessionInitializer, .SSLSessionVerifier, .TlsDetails, .TransportSecurityLayer, org.apache.hc.core5.util.Identifiable, .Timeout, org.slf4j.Logger, .LoggerFactory

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
private final IOSession
private static final Logger
private final Timeout

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
activate()

Implements org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.activate.

Restores the connection from idle mode.
public void
close(final CloseMode
How to close the receiver.
closeMode
)

Implements org.apache.hc.core5.io.ModalCloseable.close.

Closes this process or endpoint and releases any system resources associated with it.
public void
close()

Implements org.apache.hc.core5.http.HttpConnection.close.

Closes this connection gracefully.
public EndpointDetails
getEndpointDetails()

Implements org.apache.hc.core5.http.HttpConnection.getEndpointDetails.

Returns this connection's endpoint details.
public String
public SocketAddress
getLocalAddress()

Implements org.apache.hc.core5.http.HttpConnection.getLocalAddress.

Returns this connection's local address or null if it is not bound yet.
public ProtocolVersion
getProtocolVersion()

Implements org.apache.hc.core5.http.HttpConnection.getProtocolVersion.

Returns this connection's protocol version or null if unknown.
public SocketAddress
getRemoteAddress()

Implements org.apache.hc.core5.http.HttpConnection.getRemoteAddress.

Returns this connection's remote address or null if it is not connected yet or unconnected.
public Timeout
public SSLSession
getSSLSession()

Implements org.apache.hc.core5.http.HttpConnection.getSSLSession.

Returns this connection's SSL session or null if TLS has not been activated.
public TlsDetails
getTlsDetails()

Implements org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.getTlsDetails.

Returns details of a fully established TLS session.
public boolean
isOpen()

Implements org.apache.hc.core5.http.HttpConnection.isOpen.

Checks if this connection is open.
public void
public void
setSocketTimeout(final Timeout
timeout value
timeout
)

Implements org.apache.hc.core5.http.SocketModalCloseable.setSocketTimeout.

Sets the socket timeout value.
public void
startTls(final SSLContext
SSL context to be used for this session.
sslContext
,
final NamedEndpoint
optional endpoint details for outgoing client side connections.
endpoint
,
final SSLBufferMode
SSL buffer management mode.
sslBufferMode
,
final SSLSessionInitializer
SSL session initialization callback.
initializer
,
final SSLSessionVerifier
SSL session verification callback.
verifier
,
final Timeout
the timeout to use while performing the TLS handshake; may be null.
handshakeTimeout
,
final FutureCallback<TransportSecurityLayer> callback)

Overrides default org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.startTls.

Starts TLS session over an existing network connection with the given SSL context.
public void
startTls(final SSLContext
SSL context to be used for this session.
sslContext
,
final NamedEndpoint
optional endpoint details for outgoing client side connections.
endpoint
,
final SSLBufferMode
SSL buffer management mode.
sslBufferMode
,
final SSLSessionInitializer
SSL session initialization callback.
initializer
,
final SSLSessionVerifier
SSL session verification callback.
verifier
,
final Timeout
the timeout to use while performing the TLS handshake; may be null.
handshakeTimeout
)

Implements org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.startTls.

Starts TLS session over an existing network connection with the given SSL context.
public void
submitCommand(final Command
the command to be executed.
command
,
final Command.Priority
the command priority.
priority
)

Implements org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.submitCommand.

Submits the given command for execution.
public void
switchProtocol(final String
the application protocol ID
protocolId
,
final FutureCallback<ProtocolIOSession>
the result callback
callback
)

Overrides default org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.switchProtocol.

Switches this I/O session to the application protocol with the given ID.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

closedback to summary
private final AtomicBoolean closed
ioSessionback to summary
private final IOSession ioSession
LOGback to summary
private static final Logger LOG
socketTimeoutback to summary
private final Timeout socketTimeout

Constructor Detail

DefaultManagedAsyncClientConnectionback to summary
public DefaultManagedAsyncClientConnection(final IOSession ioSession)

Method Detail

activateback to summary
public void activate()

Implements org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.activate.

Doc from org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.activate.

Restores the connection from idle mode.

Annotations
@Override
closeback to summary
public void close(final CloseMode closeMode)

Implements org.apache.hc.core5.io.ModalCloseable.close.

Doc from org.apache.hc.core5.io.ModalCloseable.close.

Closes this process or endpoint and releases any system resources associated with it. If the endpoint or the process is already closed then invoking this method has no effect.

Parameters
closeMode:CloseMode

How to close the receiver.

Annotations
@Override
closeback to summary
public void close() throws IOException

Implements org.apache.hc.core5.http.HttpConnection.close.

Doc from org.apache.hc.core5.http.HttpConnection.close.

Closes this connection gracefully. This method will attempt to flush the internal output buffer prior to closing the underlying socket. This method MUST NOT be called from a different thread to force shutdown of the connection. Use shutdown instead.

Annotations
@Override
Exceptions
IOException:

Doc from java.io.Closeable.close.

if an I/O error occurs

getEndpointDetailsback to summary
public EndpointDetails getEndpointDetails()

Implements org.apache.hc.core5.http.HttpConnection.getEndpointDetails.

Doc from org.apache.hc.core5.http.HttpConnection.getEndpointDetails.

Returns this connection's endpoint details.

Returns:EndpointDetails

this connection's endpoint details.

Annotations
@Override
getIdback to summary
public String getId()

Implements org.apache.hc.core5.util.Identifiable.getId.

Annotations
@Override
getLocalAddressback to summary
public SocketAddress getLocalAddress()

Implements org.apache.hc.core5.http.HttpConnection.getLocalAddress.

Doc from org.apache.hc.core5.http.HttpConnection.getLocalAddress.

Returns this connection's local address or null if it is not bound yet.

Returns:SocketAddress

this connection's local address or null if it is not bound yet.

Annotations
@Override
getProtocolVersionback to summary
public ProtocolVersion getProtocolVersion()

Implements org.apache.hc.core5.http.HttpConnection.getProtocolVersion.

Doc from org.apache.hc.core5.http.HttpConnection.getProtocolVersion.

Returns this connection's protocol version or null if unknown.

Returns:ProtocolVersion

this connection's protocol version or null if unknown.

Annotations
@Override
getRemoteAddressback to summary
public SocketAddress getRemoteAddress()

Implements org.apache.hc.core5.http.HttpConnection.getRemoteAddress.

Doc from org.apache.hc.core5.http.HttpConnection.getRemoteAddress.

Returns this connection's remote address or null if it is not connected yet or unconnected.

Returns:SocketAddress

this connection's remote address or null if it is not connected yet or unconnected.

Annotations
@Override
getSocketTimeoutback to summary
public Timeout getSocketTimeout()

Implements org.apache.hc.core5.http.SocketModalCloseable.getSocketTimeout.

Doc from org.apache.hc.core5.http.SocketModalCloseable.getSocketTimeout.

Returns the socket timeout value.

Returns:Timeout

timeout value.

Annotations
@Override
getSSLSessionback to summary
public SSLSession getSSLSession()

Implements org.apache.hc.core5.http.HttpConnection.getSSLSession.

Doc from org.apache.hc.core5.http.HttpConnection.getSSLSession.

Returns this connection's SSL session or null if TLS has not been activated.

Returns:SSLSession

this connection's SSL session or null if TLS has not been activated.

Annotations
@Override
getTlsDetailsback to summary
public TlsDetails getTlsDetails()

Implements org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.getTlsDetails.

Doc from org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.getTlsDetails.

Returns details of a fully established TLS session.

Returns:TlsDetails

TLS session details.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements org.apache.hc.core5.http.HttpConnection.isOpen.

Doc from org.apache.hc.core5.http.HttpConnection.isOpen.

Checks if this connection is open.

Returns:boolean

true if it is open, false if it is closed.

Annotations
@Override
passivateback to summary
public void passivate()

Implements org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.passivate.

Doc from org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.passivate.

Puts the connection into idle mode.

Annotations
@Override
setSocketTimeoutback to summary
public void setSocketTimeout(final Timeout timeout)

Implements org.apache.hc.core5.http.SocketModalCloseable.setSocketTimeout.

Doc from org.apache.hc.core5.http.SocketModalCloseable.setSocketTimeout.

Sets the socket timeout value.

Parameters
timeout:Timeout

timeout value

Annotations
@Override
startTlsback to summary
public void startTls(final SSLContext sslContext, final NamedEndpoint endpoint, final SSLBufferMode sslBufferMode, final SSLSessionInitializer initializer, final SSLSessionVerifier verifier, final Timeout handshakeTimeout, final FutureCallback<TransportSecurityLayer> callback) throws UnsupportedOperationException

Overrides default org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.startTls.

Doc from org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.startTls.

Starts TLS session over an existing network connection with the given SSL context. NamedEndpoint details are applicable for client side connections and are used for host name verification, when supported by the SSL engine.

Parameters
sslContext:SSLContext

SSL context to be used for this session.

endpoint:NamedEndpoint

optional endpoint details for outgoing client side connections.

sslBufferMode:SSLBufferMode

SSL buffer management mode.

initializer:SSLSessionInitializer

SSL session initialization callback.

verifier:SSLSessionVerifier

SSL session verification callback.

handshakeTimeout:Timeout

the timeout to use while performing the TLS handshake; may be null.

Annotations
@Override
startTlsback to summary
public void startTls(final SSLContext sslContext, final NamedEndpoint endpoint, final SSLBufferMode sslBufferMode, final SSLSessionInitializer initializer, final SSLSessionVerifier verifier, final Timeout handshakeTimeout) throws UnsupportedOperationException

Implements org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.startTls.

Doc from org.apache.hc.core5.reactor.ssl.TransportSecurityLayer.startTls.

Starts TLS session over an existing network connection with the given SSL context. NamedEndpoint details are applicable for client side connections and are used for host name verification, when supported by the SSL engine.

Parameters
sslContext:SSLContext

SSL context to be used for this session.

endpoint:NamedEndpoint

optional endpoint details for outgoing client side connections.

sslBufferMode:SSLBufferMode

SSL buffer management mode.

initializer:SSLSessionInitializer

SSL session initialization callback.

verifier:SSLSessionVerifier

SSL session verification callback.

handshakeTimeout:Timeout

the timeout to use while performing the TLS handshake; may be null.

Annotations
@Override
submitCommandback to summary
public void submitCommand(final Command command, final Command.Priority priority)

Implements org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.submitCommand.

Doc from org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.submitCommand.

Submits the given command for execution.

Parameters
command:Command

the command to be executed.

priority:Command.Priority

the command priority.

Annotations
@Override
switchProtocolback to summary
public void switchProtocol(final String protocolId, final FutureCallback<ProtocolIOSession> callback) throws UnsupportedOperationException

Overrides default org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.switchProtocol.

Doc from org.apache.hc.client5.http.nio.ManagedAsyncClientConnection.switchProtocol.

Switches this I/O session to the application protocol with the given ID.

Parameters
protocolId:String

the application protocol ID

callback:FutureCallback<ProtocolIOSession>

the result callback

Annotations
@Override
Exceptions
UnsupportedOperationException:
if application protocol switch is not supported.