Class HttpProtocolNegotiator
java.lang.Object
org.apache.hc.core5.http2.impl.nio.HttpProtocolNegotiator
- All Implemented Interfaces:
Closeable
,AutoCloseable
,HttpConnection
,HttpConnectionEventHandler
,SocketModalCloseable
,ModalCloseable
,IOEventHandler
- Since:
- 5.2
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final AtomicBoolean
private final ProtocolIOSession
private final AtomicReference
<ProtocolVersion> private final FutureCallback
<ProtocolIOSession> -
Constructor Summary
ConstructorsConstructorDescriptionHttpProtocolNegotiator
(ProtocolIOSession ioSession, FutureCallback<ProtocolIOSession> resultCallback) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Closes this connection gracefully.void
Closes this process or endpoint and releases any system resources associated with it.void
Triggered after the given session has been just created.void
disconnected
(IOSession session) Triggered when the given session has been terminated.void
Triggered when the given session throws a exception.Returns this connection's endpoint details.Returns this connection's local address ornull
if it is not bound yet.Returns this connection's protocol version ornull
if unknown.Returns this connection's remote address ornull
if it is not connected yet or unconnected.Returns the socket timeout value.Returns this connection's SSL session ornull
if TLS has not been activated.void
inputReady
(IOSession session, ByteBuffer src) Triggered when the given session has input pending.boolean
isOpen()
Checks if this connection is open.void
outputReady
(IOSession session) Triggered when the given session is ready for output.void
setSocketTimeout
(Timeout timeout) Sets the socket timeout value.(package private) void
startProtocol
(HttpVersion httpVersion) void
Triggered when the given session has timed out.toString()
-
Field Details
-
ioSession
-
resultCallback
-
completed
-
negotiatedProtocolRef
-
-
Constructor Details
-
HttpProtocolNegotiator
public HttpProtocolNegotiator(ProtocolIOSession ioSession, FutureCallback<ProtocolIOSession> resultCallback)
-
-
Method Details
-
startProtocol
-
connected
Description copied from interface:IOEventHandler
Triggered after the given session has been just created.- Specified by:
connected
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
IOException
-
inputReady
Description copied from interface:IOEventHandler
Triggered when the given session has input pending.- Specified by:
inputReady
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
IOException
-
outputReady
Description copied from interface:IOEventHandler
Triggered when the given session is ready for output.- Specified by:
outputReady
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.- Throws:
IOException
-
timeout
Description copied from interface:IOEventHandler
Triggered when the given session has timed out.- Specified by:
timeout
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.timeout
- the timeout.
-
exception
Description copied from interface:IOEventHandler
Triggered when the given session throws a exception.- Specified by:
exception
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.
-
disconnected
Description copied from interface:IOEventHandler
Triggered when the given session has been terminated.- Specified by:
disconnected
in interfaceIOEventHandler
- Parameters:
session
- the I/O session.
-
getSSLSession
Description copied from interface:HttpConnection
Returns this connection's SSL session ornull
if TLS has not been activated.- Specified by:
getSSLSession
in interfaceHttpConnection
- Returns:
- this connection's SSL session or
null
if TLS has not been activated.
-
getEndpointDetails
Description copied from interface:HttpConnection
Returns this connection's endpoint details.- Specified by:
getEndpointDetails
in interfaceHttpConnection
- Returns:
- this connection's endpoint details.
-
setSocketTimeout
Description copied from interface:SocketModalCloseable
Sets the socket timeout value.- Specified by:
setSocketTimeout
in interfaceSocketModalCloseable
- Parameters:
timeout
- timeout value
-
getSocketTimeout
Description copied from interface:SocketModalCloseable
Returns the socket timeout value.- Specified by:
getSocketTimeout
in interfaceSocketModalCloseable
- Returns:
- timeout value.
-
getProtocolVersion
Description copied from interface:HttpConnection
Returns this connection's protocol version ornull
if unknown.- Specified by:
getProtocolVersion
in interfaceHttpConnection
- Returns:
- this connection's protocol version or
null
if unknown.
-
getRemoteAddress
Description copied from interface:HttpConnection
Returns this connection's remote address ornull
if it is not connected yet or unconnected.- Specified by:
getRemoteAddress
in interfaceHttpConnection
- Returns:
- this connection's remote address or
null
if it is not connected yet or unconnected.
-
getLocalAddress
Description copied from interface:HttpConnection
Returns this connection's local address ornull
if it is not bound yet.- Specified by:
getLocalAddress
in interfaceHttpConnection
- Returns:
- this connection's local address or
null
if it is not bound yet.
-
isOpen
public boolean isOpen()Description copied from interface:HttpConnection
Checks if this connection is open.- Specified by:
isOpen
in interfaceHttpConnection
- Returns:
- true if it is open, false if it is closed.
-
close
Description copied from interface:HttpConnection
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. Useshutdown
instead.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceHttpConnection
- Throws:
IOException
-
close
Description copied from interface:ModalCloseable
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.- Specified by:
close
in interfaceModalCloseable
- Parameters:
closeMode
- How to close the receiver.
-
toString
-