Top Fields Constructors Methods
org.apache.hc.core5.http2.impl.nio

public Class HttpProtocolNegotiator

extends Object
implements HttpConnectionEventHandler
Class Inheritance
All Implemented Interfaces
org.apache.hc.core5.http.impl.nio.HttpConnectionEventHandler, org.apache.hc.core5.http.HttpConnection, org.apache.hc.core5.http.SocketModalCloseable, org.apache.hc.core5.io.ModalCloseable, java.io.Closeable, java.lang.AutoCloseable, org.apache.hc.core5.reactor.IOEventHandler
Annotations
@Internal
Imports
java.io.IOException, java.net.SocketAddress, java.nio.ByteBuffer, java.util.concurrent.atomic.AtomicBoolean, .AtomicReference, javax.net.ssl.SSLSession, org.apache.hc.core5.annotation.Internal, org.apache.hc.core5.concurrent.FutureCallback, org.apache.hc.core5.http.ConnectionClosedException, .EndpointDetails, .HttpVersion, .ProtocolVersion, org.apache.hc.core5.http.impl.nio.HttpConnectionEventHandler, org.apache.hc.core5.http.nio.command.CommandSupport, org.apache.hc.core5.http2.ssl.ApplicationProtocol, org.apache.hc.core5.io.CloseMode, .SocketTimeoutExceptionFactory, org.apache.hc.core5.reactor.IOSession, .ProtocolIOSession, org.apache.hc.core5.reactor.ssl.TlsDetails, org.apache.hc.core5.util.Args, .TextUtils, .Timeout

Since
5.2

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
private final ProtocolIOSession
private final AtomicReference<ProtocolVersion>
private final FutureCallback<ProtocolIOSession>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close()

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

Closes this connection gracefully.
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
connected(final IOSession
the I/O session.
session
)

Implements org.apache.hc.core5.reactor.IOEventHandler.connected.

Triggered after the given session has been just created.
public void
disconnected(final IOSession
the I/O session.
session
)

Implements org.apache.hc.core5.reactor.IOEventHandler.disconnected.

Triggered when the given session has been terminated.
public void
exception(final IOSession
the I/O session.
session
,
final Exception cause)

Implements org.apache.hc.core5.reactor.IOEventHandler.exception.

Triggered when the given session throws a exception.
public EndpointDetails
getEndpointDetails()

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

Returns this connection's endpoint details.
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 void
inputReady(final IOSession
the I/O session.
session
,
final ByteBuffer src)

Implements org.apache.hc.core5.reactor.IOEventHandler.inputReady.

Triggered when the given session has input pending.
public boolean
isOpen()

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

Checks if this connection is open.
public void
outputReady(final IOSession
the I/O session.
session
)

Implements org.apache.hc.core5.reactor.IOEventHandler.outputReady.

Triggered when the given session is ready for output.
public void
setSocketTimeout(final Timeout
timeout value
timeout
)

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

Sets the socket timeout value.
pack-priv void
startProtocol(final HttpVersion httpVersion)

public void
timeout(final IOSession
the I/O session.
session
,
final Timeout
the timeout.
timeout
)

Implements org.apache.hc.core5.reactor.IOEventHandler.timeout.

Triggered when the given session has timed out.
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

completedback to summary
private final AtomicBoolean completed
ioSessionback to summary
private final ProtocolIOSession ioSession
negotiatedProtocolRefback to summary
private final AtomicReference<ProtocolVersion> negotiatedProtocolRef
resultCallbackback to summary
private final FutureCallback<ProtocolIOSession> resultCallback

Constructor Detail

HttpProtocolNegotiatorback to summary
public HttpProtocolNegotiator(final ProtocolIOSession ioSession, final FutureCallback<ProtocolIOSession> resultCallback)

Method Detail

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

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
connectedback to summary
public void connected(final IOSession session) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.connected.

Doc from org.apache.hc.core5.reactor.IOEventHandler.connected.

Triggered after the given session has been just created.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
disconnectedback to summary
public void disconnected(final IOSession session)

Implements org.apache.hc.core5.reactor.IOEventHandler.disconnected.

Doc from org.apache.hc.core5.reactor.IOEventHandler.disconnected.

Triggered when the given session has been terminated.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
exceptionback to summary
public void exception(final IOSession session, final Exception cause)

Implements org.apache.hc.core5.reactor.IOEventHandler.exception.

Doc from org.apache.hc.core5.reactor.IOEventHandler.exception.

Triggered when the given session throws a exception.

Parameters
session:IOSession

the I/O session.

Annotations
@Override
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
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
inputReadyback to summary
public void inputReady(final IOSession session, final ByteBuffer src) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.inputReady.

Doc from org.apache.hc.core5.reactor.IOEventHandler.inputReady.

Triggered when the given session has input pending.

Parameters
session:IOSession

the I/O session.

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
outputReadyback to summary
public void outputReady(final IOSession session) throws IOException

Implements org.apache.hc.core5.reactor.IOEventHandler.outputReady.

Doc from org.apache.hc.core5.reactor.IOEventHandler.outputReady.

Triggered when the given session is ready for output.

Parameters
session:IOSession

the I/O session.

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
startProtocolback to summary
pack-priv void startProtocol(final HttpVersion httpVersion)
timeoutback to summary
public void timeout(final IOSession session, final Timeout timeout)

Implements org.apache.hc.core5.reactor.IOEventHandler.timeout.

Doc from org.apache.hc.core5.reactor.IOEventHandler.timeout.

Triggered when the given session has timed out.

Parameters
session:IOSession

the I/O session.

timeout:Timeout

the timeout.

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override