@Override
  public ByteBufferSharing readAtLeast(SocketChannel channel, int bytes,
      ByteBuffer wrappedBuffer) throws IOException {
    try (final ByteBufferSharing inputSharing = inputBufferVendor.open()) {

      ByteBuffer peerAppData = inputSharing.getBuffer();

      if (peerAppData.capacity() > bytes) {
        // we already have a buffer that's big enough
        if (peerAppData.capacity() - peerAppData.position() < bytes) {
          peerAppData.compact();
          peerAppData.flip();
        }
      }

      while (peerAppData.remaining() < bytes) {
        wrappedBuffer.limit(wrappedBuffer.capacity());
        int amountRead = channel.read(wrappedBuffer);
        if (amountRead < 0) {
          throw new EOFException();
        }
        if (amountRead > 0) {
          wrappedBuffer.flip();
          // prep the decoded buffer for writing
          peerAppData.compact();
          try (final ByteBufferSharing inputSharing2 = unwrap(wrappedBuffer)) {
            // done writing to the decoded buffer - prep it for reading again
            final ByteBuffer peerAppDataNew = inputSharing2.getBuffer();
            peerAppDataNew.flip();
            peerAppData = peerAppDataNew; // loop needs new reference!
          }
        }
      }
      return inputBufferVendor.open();
    }
  }
This will throw an SSLHandshakeException if the handshake doesn't terminate in a FINISHED
state. It may throw other IOExceptions caused by I/O operations
geode-core/src/main/java/org/apache/geode/internal/net/NioSslEngine.java