Package org.apache.hc.core5.http
Interface HttpConnection
-
- All Superinterfaces:
java.lang.AutoCloseable,java.io.Closeable,ModalCloseable,SocketModalCloseable
- All Known Subinterfaces:
BHttpConnection,HttpClientConnection,HttpConnectionEventHandler,HttpServerConnection
- All Known Implementing Classes:
AbstractH2IOEventHandler,AbstractH2StreamMultiplexer,AbstractHttp1IOEventHandler,AbstractHttp1StreamDuplexer,BHttpConnectionBase,ClientH2IOEventHandler,ClientH2PrefaceHandler,ClientH2StreamMultiplexer,ClientHttp1IOEventHandler,ClientHttp1StreamDuplexer,DefaultBHttpClientConnection,DefaultBHttpServerConnection,HttpProtocolNegotiator,LoggingBHttpClientConnection,LoggingBHttpServerConnection,PrefaceHandlerBase,ServerH2IOEventHandler,ServerH2PrefaceHandler,ServerH2StreamMultiplexer,ServerHttp1IOEventHandler,ServerHttp1StreamDuplexer
public interface HttpConnection extends SocketModalCloseable
A generic HTTP connection, useful on client and server side.- Since:
- 4.0
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description voidclose()Closes this connection gracefully.EndpointDetailsgetEndpointDetails()Returns this connection's endpoint details.java.net.SocketAddressgetLocalAddress()Returns this connection's local address ornullif it is not bound yet.ProtocolVersiongetProtocolVersion()Returns this connection's protocol version ornullif unknown.java.net.SocketAddressgetRemoteAddress()Returns this connection's remote address ornullif it is not connected yet or unconnected.javax.net.ssl.SSLSessiongetSSLSession()Returns this connection's SSL session ornullif TLS has not been activated.booleanisOpen()Checks if this connection is open.-
Methods inherited from interface org.apache.hc.core5.io.ModalCloseable
close
-
Methods inherited from interface org.apache.hc.core5.http.SocketModalCloseable
getSocketTimeout, setSocketTimeout
-
-
-
-
Method Detail
-
close
void close() throws java.io.IOExceptionCloses 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. Useshutdowninstead.- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Throws:
java.io.IOException
-
getEndpointDetails
EndpointDetails getEndpointDetails()
Returns this connection's endpoint details.- Returns:
- this connection's endpoint details.
-
getLocalAddress
java.net.SocketAddress getLocalAddress()
Returns this connection's local address ornullif it is not bound yet.- Returns:
- this connection's local address or
nullif it is not bound yet. - Since:
- 5.0
-
getRemoteAddress
java.net.SocketAddress getRemoteAddress()
Returns this connection's remote address ornullif it is not connected yet or unconnected.- Returns:
- this connection's remote address or
nullif it is not connected yet or unconnected. - Since:
- 5.0
-
getProtocolVersion
ProtocolVersion getProtocolVersion()
Returns this connection's protocol version ornullif unknown.- Returns:
- this connection's protocol version or
nullif unknown. - Since:
- 5.0
-
getSSLSession
javax.net.ssl.SSLSession getSSLSession()
Returns this connection's SSL session ornullif TLS has not been activated.- Returns:
- this connection's SSL session or
nullif TLS has not been activated.
-
isOpen
boolean isOpen()
Checks if this connection is open.- Returns:
- true if it is open, false if it is closed.
-
-