Class NoopTransportObserver.NoopConnectionObserver
java.lang.Object
io.servicetalk.transport.netty.internal.NoopTransportObserver.NoopConnectionObserver
- All Implemented Interfaces:
ConnectionObserver
- Enclosing class:
- NoopTransportObserver
public static final class NoopTransportObserver.NoopConnectionObserver
extends Object
implements ConnectionObserver
Noop version of
ConnectionObserver
.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.transport.api.ConnectionObserver
ConnectionObserver.DataObserver, ConnectionObserver.MultiplexedObserver, ConnectionObserver.ProxyConnectObserver, ConnectionObserver.ReadObserver, ConnectionObserver.SecurityHandshakeObserver, ConnectionObserver.StreamObserver, ConnectionObserver.WriteObserver
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoid
Callback when the connection is closed.void
connectionClosed
(Throwable error) Callback when the connection is closed due to anerror
.Callback when a non-multiplexed connection is established and ready.void
connectionWritabilityChanged
(boolean isWritable) Callback when a writable state of the connection changes.Callback when a multiplexed connection is established and ready.void
onDataRead
(int size) Callback whensize
bytes are read from the connection.void
onDataWrite
(int size) Callback whensize
bytes are written to the connection.void
onFlush()
Callback when previously written data is flushed to the connection.onProxyConnect
(Object connectMsg) Callback when a proxy connect is initiated.Callback when a security handshake is initiated.onSecurityHandshake
(SslConfig sslConfig) Callback when a security handshake is initiated.void
Callback when a transport handshake completes.void
Callback when a transport handshake completes.
-
Field Details
-
INSTANCE
-
-
Method Details
-
onDataRead
public void onDataRead(int size) Description copied from interface:ConnectionObserver
Callback whensize
bytes are read from the connection.- Specified by:
onDataRead
in interfaceConnectionObserver
- Parameters:
size
- size of the data chunk read
-
onDataWrite
public void onDataWrite(int size) Description copied from interface:ConnectionObserver
Callback whensize
bytes are written to the connection.- Specified by:
onDataWrite
in interfaceConnectionObserver
- Parameters:
size
- size of the data chunk written
-
onFlush
public void onFlush()Description copied from interface:ConnectionObserver
Callback when previously written data is flushed to the connection.- Specified by:
onFlush
in interfaceConnectionObserver
-
onTransportHandshakeComplete
public void onTransportHandshakeComplete()Description copied from interface:ConnectionObserver
Callback when a transport handshake completes.Transport protocols that require a handshake in order to connect. Example: TCP "three-way handshake".
- Specified by:
onTransportHandshakeComplete
in interfaceConnectionObserver
-
onTransportHandshakeComplete
Description copied from interface:ConnectionObserver
Callback when a transport handshake completes.Transport protocols that require a handshake in order to connect. Example: TCP "three-way handshake".
- Specified by:
onTransportHandshakeComplete
in interfaceConnectionObserver
- Parameters:
info
-ConnectionInfo
for the connection after transport handshake completes. Note that theConnectionInfo.sslSession()
will always returnnull
since it is called before theConnectionObserver.onSecurityHandshake(SslConfig)
security handshake} is performed (and as a result no SSL session has been established). Also,ConnectionInfo.protocol()
will return L4 (transport) protocol. FinalizedConnectionInfo
will be available viaConnectionObserver.connectionEstablished(ConnectionInfo)
orConnectionObserver.multiplexedConnectionEstablished(ConnectionInfo)
callbacks.
-
onProxyConnect
Description copied from interface:ConnectionObserver
Callback when a proxy connect is initiated.For a typical connection, this callback is invoked after
ConnectionObserver.onTransportHandshakeComplete(ConnectionInfo)
.- Specified by:
onProxyConnect
in interfaceConnectionObserver
- Parameters:
connectMsg
- a message sent to a proxy in request to establish a connection to the target server- Returns:
- a new
ConnectionObserver.ProxyConnectObserver
that provides visibility into proxy connect events.
-
onSecurityHandshake
Description copied from interface:ConnectionObserver
Callback when a security handshake is initiated.For a typical connection, this callback is invoked after
ConnectionObserver.onTransportHandshakeComplete(ConnectionInfo)
. There are exceptions:- For a TCP connection, when
ServiceTalkSocketOptions.TCP_FASTOPEN_CONNECT
option is configured and the Fast Open feature is supported by the OS, this callback may be invoked earlier. Note, even if the Fast Open is available and configured, it may not actually happen if the Fast Open Cookie isnull
or rejected by the server. - For a proxy connections, the handshake may happen after an observer returned by
ConnectionObserver.onProxyConnect(Object)
completes successfully.
- Specified by:
onSecurityHandshake
in interfaceConnectionObserver
- Returns:
- a new
ConnectionObserver.SecurityHandshakeObserver
that provides visibility into security handshake events - See Also:
- For a TCP connection, when
-
onSecurityHandshake
Description copied from interface:ConnectionObserver
Callback when a security handshake is initiated.For a typical connection, this callback is invoked after
ConnectionObserver.onTransportHandshakeComplete(ConnectionInfo)
. There are exceptions:- For a TCP connection, when
ServiceTalkSocketOptions.TCP_FASTOPEN_CONNECT
option is configured and the Fast Open feature is supported by the OS, this callback may be invoked earlier. Note, even if the Fast Open is available and configured, it may not actually happen if the Fast Open Cookie isnull
or rejected by the server. - For a proxy connections, the handshake may happen after an observer returned by
ConnectionObserver.onProxyConnect(Object)
completes successfully.
- Specified by:
onSecurityHandshake
in interfaceConnectionObserver
- Parameters:
sslConfig
- theSslConfig
used when performing the security handshake.- Returns:
- a new
ConnectionObserver.SecurityHandshakeObserver
that provides visibility into security handshake events - See Also:
- For a TCP connection, when
-
connectionEstablished
Description copied from interface:ConnectionObserver
Callback when a non-multiplexed connection is established and ready.- Specified by:
connectionEstablished
in interfaceConnectionObserver
- Parameters:
info
-ConnectionInfo
for the established connection- Returns:
- a new
ConnectionObserver.DataObserver
that provides visibility into read and write events
-
multiplexedConnectionEstablished
Description copied from interface:ConnectionObserver
Callback when a multiplexed connection is established and ready.- Specified by:
multiplexedConnectionEstablished
in interfaceConnectionObserver
- Parameters:
info
-ConnectionInfo
for the established connection- Returns:
- a new
ConnectionObserver.MultiplexedObserver
that provides visibility into new streams
-
connectionWritabilityChanged
public void connectionWritabilityChanged(boolean isWritable) Description copied from interface:ConnectionObserver
Callback when a writable state of the connection changes.- Specified by:
connectionWritabilityChanged
in interfaceConnectionObserver
- Parameters:
isWritable
- describes the current state of the connection:true
when the I/O thread will perform the requested write operation immediately. Iffalse
, write requests will be queued until the I/O thread is ready to process the queued items and the transport will start applying backpressure.
-
connectionClosed
Description copied from interface:ConnectionObserver
Callback when the connection is closed due to anerror
.- Specified by:
connectionClosed
in interfaceConnectionObserver
- Parameters:
error
- an occurred error
-
connectionClosed
public void connectionClosed()Description copied from interface:ConnectionObserver
Callback when the connection is closed.- Specified by:
connectionClosed
in interfaceConnectionObserver
-