Interface ConnectionInfo
- All Known Subinterfaces:
ConnectionContext
,GrpcServiceContext
,HttpConnectionContext
,NettyConnection<Read,
,Write> NettyConnectionContext
- All Known Implementing Classes:
DefaultNettyConnection
,DelegatingConnectionContext
,DelegatingHttpConnectionContext
,DelegatingHttpServiceContext
,HttpServiceContext
,NettyPipelinedConnection
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic interface
Provides information about the network protocol. -
Method Summary
Modifier and TypeMethodDescriptiondefault String
String representation of an identifier for this connection (can be globally non-unique).Get theExecutionContext
for thisConnectionInfo
.TheSocketAddress
to which the associated connection is bound.protocol()
Get theConnectionInfo.Protocol
for thisConnectionInfo
.TheSocketAddress
to which the associated connection is connected.<T> T
socketOption
(SocketOption<T> option) default SslConfig
Get theSslConfig
for this connection.Get theSSLSession
for this connection.toString()
String representation of the current connection information.
-
Method Details
-
toString
String toString()String representation of the current connection information. -
connectionId
String 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
localAddress()
andremoteAddress()
.- Returns:
- String representation of an identifier for this connection (can be globally non-unique).
-
localAddress
SocketAddress localAddress()TheSocketAddress
to which the associated connection is bound.- Returns:
- The
SocketAddress
to which the associated connection is bound.
-
remoteAddress
SocketAddress remoteAddress()TheSocketAddress
to which the associated connection is connected.- Returns:
- The
SocketAddress
to which the associated connection is connected.
-
sslConfig
Get theSslConfig
for this connection.- Returns:
- The
SslConfig
if SSL/TLS is configured, ornull
otherwise.
-
sslSession
Get theSSLSession
for this connection.- Returns:
- The
SSLSession
if SSL/TLS is enabled, ornull
otherwise.
-
executionContext
ExecutionContext<?> executionContext()Get theExecutionContext
for 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 specificIoExecutor
has been selected.- Returns:
- the
ExecutionContext
for thisConnectionInfo
.
-
socketOption
- Type Parameters:
T
- the type of theSocketOption
value.- Parameters:
option
-SocketOption
to get.- Returns:
- the
SocketOption
value of typeT
for thisConnectionInfo
ornull
if thisSocketOption
is not supported by thisConnectionInfo
. - See Also:
-
protocol
ConnectionInfo.Protocol protocol()Get theConnectionInfo.Protocol
for thisConnectionInfo
.- Returns:
- the
ConnectionInfo.Protocol
for thisConnectionInfo
.
-