Package io.servicetalk.transport.api
Interface ConnectionObserver
-
- All Known Implementing Classes:
NoopTransportObserver.NoopConnectionObserver
public interface ConnectionObserver
An observer interface that provides visibility into events associated with a network connection.Either
connectionClosed()
orconnectionClosed(Throwable)
will be invoked to signal when connection is closed.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interface
ConnectionObserver.DataObserver
An observer interface that provides visibility into read and write events related to data flow.static interface
ConnectionObserver.MultiplexedObserver
An observer interface that provides visibility into new streams created by a multiplexed connection.static interface
ConnectionObserver.ReadObserver
An observer interface that provides visibility into read events.static interface
ConnectionObserver.SecurityHandshakeObserver
An observer interface that provides visibility into security handshake events.static interface
ConnectionObserver.StreamObserver
An observer interface that provides visibility into stream events.static interface
ConnectionObserver.WriteObserver
An observer interface that provides visibility into write events.
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
connectionClosed()
Callback when the connection is closed.void
connectionClosed(java.lang.Throwable error)
Callback when the connection is closed due to anerror
.ConnectionObserver.DataObserver
connectionEstablished(ConnectionInfo info)
Callback when a non-multiplexed connection is established and ready.ConnectionObserver.MultiplexedObserver
multiplexedConnectionEstablished(ConnectionInfo info)
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.ConnectionObserver.SecurityHandshakeObserver
onSecurityHandshake()
Callback when a security handshake is initiated.
-
-
-
Method Detail
-
onDataRead
void onDataRead(int size)
Callback whensize
bytes are read from the connection.- Parameters:
size
- size of the data chunk read
-
onDataWrite
void onDataWrite(int size)
Callback whensize
bytes are written to the connection.- Parameters:
size
- size of the data chunk written
-
onFlush
void onFlush()
Callback when previously written data is flushed to the connection.
-
onSecurityHandshake
ConnectionObserver.SecurityHandshakeObserver onSecurityHandshake()
Callback when a security handshake is initiated.- Returns:
- a new
ConnectionObserver.SecurityHandshakeObserver
that provides visibility into security handshake events
-
connectionEstablished
ConnectionObserver.DataObserver connectionEstablished(ConnectionInfo info)
Callback when a non-multiplexed connection is established and ready.- Parameters:
info
-ConnectionInfo
for the established connection- Returns:
- a new
ConnectionObserver.DataObserver
that provides visibility into read and write events
-
multiplexedConnectionEstablished
ConnectionObserver.MultiplexedObserver multiplexedConnectionEstablished(ConnectionInfo info)
Callback when a multiplexed connection is established and ready.- Parameters:
info
-ConnectionInfo
for the established connection- Returns:
- a new
ConnectionObserver.MultiplexedObserver
that provides visibility into new streams
-
connectionClosed
void connectionClosed(java.lang.Throwable error)
Callback when the connection is closed due to anerror
.- Parameters:
error
- an occurred error
-
connectionClosed
void connectionClosed()
Callback when the connection is closed.
-
-