code: public static SSLSocketChannel open(SocketChannel socketChannel, SSLContext sslContext, ByteBuffer consumed, boolean autoClose) throws IOException
      {
          SSLEngine engine = sslContext.createSSLEngine();
          engine.setUseClientMode(false);
          SSLSocketChannel sslSocketChannel = new SSLSocketChannel(socketChannel, engine, consumed, !autoClose);
          return sslSocketChannel;
      }
docs: Creates SSLSocketChannel over connected SocketChannel using given
  SSLContext. Connection is in server mode, but can be changed before read/write.
  @param socketChannel
  @param sslContext
  @param consumed If not null, ByteBuffer's remaining can contain bytes
  that are consumed by SocketChannel, but are part of SSL connection. Bytes
  are moved from this buffer. This buffers hasRemaining is false after call.
  @param autoClose If true the SocketChannel is closed when SSLSocketChannel
  is closed.
  @return
  @throws IOException