Class DelegatingConnectionContext
- All Implemented Interfaces:
AsyncCloseable,ListenableAsyncCloseable,ConnectionContext,ConnectionInfo
- Direct Known Subclasses:
DelegatingHttpConnectionContext
ConnectionContext implementation that delegates all calls to a provided ConnectionContext. Any of
the methods can be overridden by implementations to change the behavior.-
Nested Class Summary
Nested classes/interfaces inherited from interface io.servicetalk.transport.api.ConnectionInfo
ConnectionInfo.Protocol -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionString representation of an identifier for this connection (can be globally non-unique).protected ConnectionContextdelegate()Get theConnectionContextthat this class delegates to.Get theExecutionContextfor thisConnectionInfo.TheSocketAddressto which the associated connection is bound.parent()Returns a reference to a parentConnectionContextif any.protocol()Get theConnectionInfo.Protocolfor thisConnectionInfo.TheSocketAddressto which the associated connection is connected.<T> TsocketOption(SocketOption<T> option) Get theSslConfigfor this connection.Get theSSLSessionfor this connection.toString()String representation of the current connection information.Methods inherited from class io.servicetalk.concurrent.api.DelegatingListenableAsyncCloseable
onClose, onClosingMethods inherited from class io.servicetalk.concurrent.api.DelegatingAsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface io.servicetalk.concurrent.api.AsyncCloseable
closeAsync, closeAsyncGracefullyMethods inherited from interface io.servicetalk.concurrent.api.ListenableAsyncCloseable
onClose, onClosing
-
Constructor Details
-
DelegatingConnectionContext
New instance.- Parameters:
delegate-ConnectionContextto delegate all calls.
-
-
Method Details
-
delegate
Get theConnectionContextthat this class delegates to.- Overrides:
delegatein classDelegatingListenableAsyncCloseable<ConnectionContext>- Returns:
- the
ConnectionContextthat this class delegates to.
-
connectionId
Description copied from interface:ConnectionInfoString representation of an identifier for this connection (can be globally non-unique).Note: this identifier is a string representation of an ID assigned by underlying implementation of the connection. Whether it's globally unique or not depends on that implementation. It's not recommended to use this identifier as a map key for storing connection related data. It can be used for logging purposes to correlate events happening on this connection with other logs or events related to the same instance. If necessary, uniqueness can be ensured by using a combination of the current identifier with
ConnectionInfo.localAddress()andConnectionInfo.remoteAddress().- Specified by:
connectionIdin interfaceConnectionInfo- Returns:
- String representation of an identifier for this connection (can be globally non-unique).
-
localAddress
Description copied from interface:ConnectionInfoTheSocketAddressto which the associated connection is bound.- Specified by:
localAddressin interfaceConnectionInfo- Returns:
- The
SocketAddressto which the associated connection is bound.
-
remoteAddress
Description copied from interface:ConnectionInfoTheSocketAddressto which the associated connection is connected.- Specified by:
remoteAddressin interfaceConnectionInfo- Returns:
- The
SocketAddressto which the associated connection is connected.
-
sslConfig
Description copied from interface:ConnectionInfoGet theSslConfigfor this connection.- Specified by:
sslConfigin interfaceConnectionInfo- Returns:
- The
SslConfigif SSL/TLS is configured, ornullotherwise.
-
sslSession
Description copied from interface:ConnectionInfoGet theSSLSessionfor this connection.- Specified by:
sslSessionin interfaceConnectionInfo- Returns:
- The
SSLSessionif SSL/TLS is enabled, ornullotherwise.
-
executionContext
Description copied from interface:ConnectionInfoGet theExecutionContextfor thisConnectionInfo.The
ExecutionContext.ioExecutor()will represent the thread responsible for IO for thisConnectionInfo. Note that this maybe different that what was used to create this object because at this time a specificIoExecutorhas been selected.- Specified by:
executionContextin interfaceConnectionInfo- Returns:
- the
ExecutionContextfor thisConnectionInfo.
-
socketOption
Description copied from interface:ConnectionInfo- Specified by:
socketOptionin interfaceConnectionInfo- Type Parameters:
T- the type of theSocketOptionvalue.- Parameters:
option-SocketOptionto get.- Returns:
- the
SocketOptionvalue of typeTfor thisConnectionInfoornullif thisSocketOptionis not supported by thisConnectionInfo. - See Also:
-
protocol
Description copied from interface:ConnectionInfoGet theConnectionInfo.Protocolfor thisConnectionInfo.- Specified by:
protocolin interfaceConnectionInfo- Returns:
- the
ConnectionInfo.Protocolfor thisConnectionInfo.
-
parent
Description copied from interface:ConnectionContextReturns a reference to a parentConnectionContextif any.This method is useful when multiple virtual streams are multiplexed over a single connection to get access to the actual
ConnectionContextthat represents network.- Specified by:
parentin interfaceConnectionContext- Returns:
- a reference to a parent
ConnectionContextif any. Otherwise, returnsnull.
-
toString
Description copied from interface:ConnectionInfoString representation of the current connection information.- Specified by:
toStringin interfaceConnectionInfo- Overrides:
toStringin classDelegatingAsyncCloseable<ConnectionContext>- Returns:
- String representation of the current connection information.
-