Class SslTcpSocket

java.lang.Object
io.activej.reactor.AbstractNioReactive
io.activej.net.socket.tcp.SslTcpSocket
All Implemented Interfaces:
AsyncCloseable, ITcpSocket, io.activej.reactor.NioReactive, io.activej.reactor.Reactive

public final class SslTcpSocket extends io.activej.reactor.AbstractNioReactive implements ITcpSocket
This is an SSL proxy around ITcpSocket.

It allows SSL connections using Java SSLEngine.

  • Field Details

    • ERROR_ON_CLOSE_WITHOUT_NOTIFY

      public static final boolean ERROR_ON_CLOSE_WITHOUT_NOTIFY
  • Method Details

    • wrapClientSocket

      public static SslTcpSocket wrapClientSocket(io.activej.reactor.nio.NioReactor reactor, ITcpSocket socket, String host, int port, SSLContext sslContext, Executor executor)
    • wrapClientSocket

      public static SslTcpSocket wrapClientSocket(io.activej.reactor.nio.NioReactor reactor, ITcpSocket socket, SSLContext sslContext, Executor executor)
    • wrapServerSocket

      public static SslTcpSocket wrapServerSocket(io.activej.reactor.nio.NioReactor reactor, ITcpSocket socket, SSLContext sslContext, Executor executor)
    • create

      public static SslTcpSocket create(io.activej.reactor.nio.NioReactor reactor, ITcpSocket socket, SSLEngine engine, Executor executor)
    • read

      public Promise<ByteBuf> read()
      Description copied from interface: ITcpSocket
      Operation to read some data from network. Returns a promise of a bytebuf that represents some data received from network.

      It is allowed to call read before previous read was completed. However, each consecutive call will cancel all the previous calls (they will not be completed).

      Specified by:
      read in interface ITcpSocket
      Returns:
      promise of ByteBuf that represents data received from network
    • write

      public Promise<Void> write(@Nullable @Nullable ByteBuf buf)
      Description copied from interface: ITcpSocket
      Operation to write some data to network. Returns a promise of void that represents successful write.

      Many write operations may be called. However, when some write is successful, all the promises received from write calls before it will be completed at once.

      Specified by:
      write in interface ITcpSocket
      Parameters:
      buf - data to be sent to network
      Returns:
      promise that represents successful write operation
    • isReadAvailable

      public boolean isReadAvailable()
      Specified by:
      isReadAvailable in interface ITcpSocket
    • closeEx

      public void closeEx(Exception e)
      Specified by:
      closeEx in interface AsyncCloseable
    • isClosed

      public boolean isClosed()
      Specified by:
      isClosed in interface ITcpSocket