public interface ConnectionListener
This interface provides callback methods that are invoked when the client connection is first established,
before any TLS or HTTP application traffic is sent. This can be used for cases such as the HAProxy
Proxy Protocol, which involves sending protocol-specific data bytes on the connection before the TLS
handshake occurs.
-
Method Summary
Modifier and TypeMethodDescriptionstatic ConnectionListenerReturns aConnectionListenerwhich does nothing.static ConnectionListenercreateWriteOnConnect(byte[] bytes) Returns aConnectionListenerwhich writes bytes to the socket once the socket is connected.voidsocketChannelConnected(ConnectedSocketChannelInfo socketInfo) Called when the givenSocketChannelconnection has been established andSocketOptionsapplied, but before any TLS or HTTP application traffic has been sent.voidsocketConnected(ConnectedSocketInfo socketInfo) Called when the givenSocketconnection has been established andSocketOptionsapplied, but before any TLS or HTTP application traffic has been sent.
-
Method Details
-
createNoop
Returns aConnectionListenerwhich does nothing.- Returns:
- The no-op listener.
-
createWriteOnConnect
Returns aConnectionListenerwhich writes bytes to the socket once the socket is connected.- Parameters:
bytes- The bytes to write.- Returns:
- The listener which will write the given bytes to the socket.
-
socketConnected
Called when the givenSocketconnection has been established andSocketOptionsapplied, but before any TLS or HTTP application traffic has been sent.- Parameters:
socketInfo- The newly connected socket.- Throws:
IOException
-
socketChannelConnected
Called when the givenSocketChannelconnection has been established andSocketOptionsapplied, but before any TLS or HTTP application traffic has been sent.- Parameters:
socketInfo- The newly connected socket channel.- Throws:
IOException
-