Interface Connection
- All Superinterfaces:
- AutoCloseable,- Closeable
- All Known Implementing Classes:
- AbstractConnection,- ALPNClientConnection,- ALPNServerConnection,- ClientQuicConnection,- ConnectHandler.DownstreamConnection,- ConnectHandler.UpstreamConnection,- HTTP2Connection,- HTTP2ServerConnection,- HttpConnection,- HttpConnectionOverFCGI,- HttpConnectionOverHTTP,- NegotiatingClientConnection,- NegotiatingServerConnection,- ProxyConnection,- ProxyProtocolClientConnectionFactory.ProxyProtocolConnection,- QuicConnection,- ServerFCGIConnection,- ServerQuicConnection,- SslConnection,- WebSocketConnection
A Connection is associated to an EndPoint so that I/O events
 happening on the EndPoint can be processed by the Connection.
A typical implementation of Connection overrides onOpen() to
 set read interest on the EndPoint,
 and when the EndPoint signals read readyness, this Connection can
 read bytes from the network and interpret them.
- 
Nested Class SummaryNested ClassesModifier and TypeInterfaceDescriptionstatic interfaceA Listener for connection events.static interfaceConnectionimplementations implement this interface when they can upgrade from the protocol they speak (for example HTTP/1.1) to a different protocol (e.g.static interfaceConnectionimplementations implement this interface when they can be upgraded to the protocol they speak (e.g.
- 
Method SummaryModifier and TypeMethodDescriptionvoidaddEventListener(EventListener listener) Adds a listener of connection events.voidclose()Performs a logical close of this connection.longlonglonglonglongvoidCallback method invoked when this connection is closed.booleanCallback method invoked upon an idle timeout event.voidonOpen()Callback method invoked when this connection is opened.voidremoveEventListener(EventListener listener) Removes a listener of connection events.
- 
Method Details- 
addEventListenerAdds a listener of connection events. - Parameters:
- listener- the listener to add
 
- 
removeEventListenerRemoves a listener of connection events. - Parameters:
- listener- the listener to remove
 
- 
onOpenvoid onOpen()Callback method invoked when this connection is opened. Creators of the connection implementation are responsible for calling this method. 
- 
onCloseCallback method invoked when this connection is closed. Creators of the connection implementation are responsible for calling this method. - Parameters:
- cause- The cause of the close or null for a normal close
 
- 
getEndPointEndPoint getEndPoint()- Returns:
- the EndPointassociated with this Connection.
 
- 
closevoid close()Performs a logical close of this connection. For simple connections, this may just mean to delegate the close to the associated EndPointbut, for example, SSL connections should write the SSL close message before closing the associatedEndPoint.- Specified by:
- closein interface- AutoCloseable
- Specified by:
- closein interface- Closeable
 
- 
onIdleExpiredboolean onIdleExpired()Callback method invoked upon an idle timeout event. Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed. When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event. - Returns:
- true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
 
- 
getMessagesInlong getMessagesIn()
- 
getMessagesOutlong getMessagesOut()
- 
getBytesInlong getBytesIn()
- 
getBytesOutlong getBytesOut()
- 
getCreatedTimeStamplong getCreatedTimeStamp()
 
-