code: private ByteBuf writeEncryptedData(final ByteBuffer src, int len) {
          final int pos = src.position();
          if (src.isDirect()) {
              SSL.bioSetByteBuffer(networkBIO, bufferAddress(src) + pos, len, false);
          } else {
              final ByteBuf buf = alloc.directBuffer(len);
              try {
                  final int limit = src.limit();
                  src.limit(pos + len);
                  buf.writeBytes(src);
                  // Restore the original position and limit because we don't want to consume from `src`.
                  src.position(pos);
                  src.limit(limit);
  
                  SSL.bioSetByteBuffer(networkBIO, memoryAddress(buf), len, false);
                  return buf;
              } catch (Throwable cause) {
                  buf.release();
                  PlatformDependent.throwException(cause);
              }
          }
          return null;
      }
docs: Write encrypted data to the OpenSSL network BIO.