Interface ConnectionInfo

All Known Subinterfaces:
ConnectionContext, GrpcServiceContext, HttpConnectionContext, NettyConnection<Read,Write>, NettyConnectionContext
All Known Implementing Classes:
DefaultNettyConnection, DelegatingConnectionContext, DelegatingHttpConnectionContext, DelegatingHttpServiceContext, HttpServiceContext, NettyPipelinedConnection

public interface ConnectionInfo
Provides information about a connection.
  • Method Details

    • toString

      String toString()
      String representation of the current connection information.
      Overrides:
      toString in class Object
      Returns:
      String representation of the current connection information.
    • connectionId

      default String 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() and remoteAddress().

      Returns:
      String representation of an identifier for this connection (can be globally non-unique).
    • localAddress

      SocketAddress localAddress()
      The SocketAddress to which the associated connection is bound.
      Returns:
      The SocketAddress to which the associated connection is bound.
    • remoteAddress

      SocketAddress remoteAddress()
      The SocketAddress to which the associated connection is connected.

      On the client side, when a proxy is configured, this describes the TCP peer (i.e. the proxy), not the target server the application is communicating with.

      Returns:
      The SocketAddress to which the associated connection is connected.
    • sslConfig

      @Nullable default SslConfig sslConfig()
      Get the SslConfig for this connection.

      On the client side, when the connection runs through a TLS proxy, this describes the application SSL configuration (the handshake performed with the target server), not the proxy SSL configuration.

      Returns:
      The SslConfig if SSL/TLS is configured, or null otherwise.
    • sslSession

      @Nullable SSLSession sslSession()
      Get the SSLSession for this connection.

      On the client side, when the connection runs through a TLS proxy, this describes the application SSL session (the handshake performed with the target server), not the proxy SSL session.

      Returns:
      The SSLSession if SSL/TLS is enabled, or null otherwise.
    • executionContext

      ExecutionContext<?> executionContext()
      Get the ExecutionContext for this ConnectionInfo.

      The ExecutionContext.ioExecutor() will represent the thread responsible for IO for this ConnectionInfo. Note that this maybe different that what was used to create this object because at this time a specific IoExecutor has been selected.

      Returns:
      the ExecutionContext for this ConnectionInfo.
    • socketOption

      @Nullable <T> T socketOption(SocketOption<T> option)
      Get the SocketOption value of type T for this ConnectionInfo.
      Type Parameters:
      T - the type of the SocketOption value.
      Parameters:
      option - SocketOption to get.
      Returns:
      the SocketOption value of type T for this ConnectionInfo or null if this SocketOption is not supported by this ConnectionInfo.
      See Also:
    • protocol

      Returns:
      the ConnectionInfo.Protocol for this ConnectionInfo.