private void readMessageFromNIOSSLClient(Socket socket, ByteBuffer buffer, NioSslEngine engine)
      throws IOException {

    try (final ByteBufferSharing sharedBuffer = engine.getUnwrappedBuffer()) {
      final ByteBuffer unwrapped = sharedBuffer.getBuffer();
      // if we already have unencrypted data skip unwrapping
      if (unwrapped.position() == 0) {
        int bytesRead;
        // if we already have encrypted data skip reading from the socket
        if (buffer.position() == 0) {
          bytesRead = socket.getChannel().read(buffer);
          buffer.flip();
        } else {
          bytesRead = buffer.remaining();
        }
        System.out.println("server bytes read is " + bytesRead + ": buffer position is "
            + buffer.position() + " and limit is " + buffer.limit());
        try (final ByteBufferSharing sharedBuffer2 = engine.unwrap(buffer)) {
          final ByteBuffer unwrapped2 = sharedBuffer2.getBuffer();

          unwrapped2.flip();
          System.out.println("server unwrapped buffer position is " + unwrapped2.position()
              + " and limit is " + unwrapped2.limit());
          finishReadMessageFromNIOSSLClient(unwrapped2);
        }
      } else {
        finishReadMessageFromNIOSSLClient(unwrapped);
      }
    }
  }
see GEODE-4087. Geode should not establish a default SSLContext, preventing apps from using
different ssl settings via standard system properties. Since this test class sets these system
properties to establish a default context we merely need to perform an equality check between
the cluster's context and the default context and assert that they aren't the same.
geode-core/src/integrationTest/java/org/apache/geode/internal/net/SSLSocketIntegrationTest.java