Class TlsNioSocket

java.lang.Object
io.helidon.common.socket.NioSocket
io.helidon.common.socket.TlsNioSocket
All Implemented Interfaces:
HelidonSocket, SocketContext, Supplier<byte[]>

public final class TlsNioSocket extends NioSocket
TLS NIO helidon socket.
  • Method Details

    • server

      public static TlsNioSocket server(SocketChannel delegate, SSLEngine sslEngine, String channelId, String serverChannelId)
      Create a server TLS NIO socket.
      Parameters:
      delegate - underlying socket
      sslEngine - SSL engine
      channelId - connection channel id
      serverChannelId - listener channel id
      Returns:
      a new TLS socket
    • server

      public static TlsNioSocket server(SocketChannel delegate, SSLEngine sslEngine, String channelId, String serverChannelId, ByteBuffer replayNetData)
      Create a server TLS NIO socket with already-read TLS network data to replay into the first unwrap. This is intended for server implementations that need to inspect TLS records before creating the engine.
      Parameters:
      delegate - underlying socket
      sslEngine - SSL engine
      channelId - connection channel id
      serverChannelId - listener channel id
      replayNetData - already-read TLS network data
      Returns:
      a new TLS socket
    • client

      public static TlsNioSocket client(SocketChannel delegate, SSLEngine sslEngine, String channelId)
      Create a client TLS NIO socket.
      Parameters:
      delegate - underlying socket
      sslEngine - SSL engine
      channelId - channel id
      Returns:
      a new TLS socket
    • remotePeer

      public PeerInfo remotePeer()
      Description copied from interface: SocketContext
      Remote peer information.
      Specified by:
      remotePeer in interface SocketContext
      Overrides:
      remotePeer in class NioSocket
      Returns:
      peer info
    • localPeer

      public PeerInfo localPeer()
      Description copied from interface: SocketContext
      Local peer information.
      Specified by:
      localPeer in interface SocketContext
      Overrides:
      localPeer in class NioSocket
      Returns:
      peer info
    • isSecure

      public boolean isSecure()
      Description copied from interface: SocketContext
      Whether the request is secure.
      Specified by:
      isSecure in interface SocketContext
      Overrides:
      isSecure in class NioSocket
      Returns:
      whether secure
    • protocolNegotiated

      public boolean protocolNegotiated()
      Description copied from interface: HelidonSocket
      Whether a protocol was negotiated by the socket (such as ALPN when using TLS).
      Returns:
      whether a protocol was negotiated
    • protocol

      public String protocol()
      Description copied from interface: HelidonSocket
      Protocol that was negotiated.
      Returns:
      protocol name
    • get

      public byte[] get()
      Specified by:
      get in interface Supplier<byte[]>
      Overrides:
      get in class NioSocket
    • write

      public void write(BufferData buffer)
      Description copied from interface: HelidonSocket
      Write teh buffer to the underlying socket. This method blocks until all bytes are written.
      Specified by:
      write in interface HelidonSocket
      Overrides:
      write in class NioSocket
      Parameters:
      buffer - buffer to write
    • handshake

      public void handshake()
      Complete the initial TLS handshake.
    • close

      public void close()
      Description copied from interface: HelidonSocket
      Close the underlying socket.
      Specified by:
      close in interface HelidonSocket
      Overrides:
      close in class NioSocket
    • idle

      public void idle()
      Description copied from interface: HelidonSocket
      Sets the socket to idle mode. Idle mode expects no bytes coming over the socket but keeps reading exactly one byte in case connection is severed. Idle mode should be used in case of client side connection caching.
      Specified by:
      idle in interface HelidonSocket
      Overrides:
      idle in class NioSocket
    • isConnected

      public boolean isConnected()
      Description copied from interface: HelidonSocket
      Check if socket is connected.
      Specified by:
      isConnected in interface HelidonSocket
      Overrides:
      isConnected in class NioSocket
      Returns:
      true if connected