code: public static List<SNIServerName> explore(ByteBuffer source)
              throws SSLException {
  
          ByteBuffer input = source.duplicate();
  
          // Do we have a complete header?
          if (input.remaining() < RECORD_HEADER_SIZE) {
              throw new BufferUnderflowException();
          }
  
          // Is it a handshake message?
          byte firstByte = input.get();
          byte secondByte = input.get();
          byte thirdByte = input.get();
          if ((firstByte & 0x80) != 0 && thirdByte == 0x01) {
              // looks like a V2ClientHello
              return Collections.emptyList();
          } else if (firstByte == 22) {   // 22: handshake record
              return exploreTLSRecord(input,
                                      firstByte, secondByte, thirdByte);
          } else {
              throw UndertowMessages.MESSAGES.notHandshakeRecord();
          }
      }
docs: Launch and explore the security capabilities from byte buffer.
  <P>
  This method tries to parse as few records as possible from
  {@code source} byte buffer to get the capabilities
  of an SSL/TLS connection.
  <P>
  Please NOTE that this method must be called before any handshaking
  occurs.  The behavior of this method is not defined in this release
  if the handshake has begun, or has completed.
  <P>
  This method accesses the {@code source} parameter in read-only
  mode, and does not update the buffer's properties such as capacity,
  limit, position, and mark values.
  
  @param  source
  a {@link ByteBuffer} containing
  inbound or outbound network data for an SSL/TLS connection.
  
  @throws IOException on network data error
  @throws BufferUnderflowException if not enough source bytes available
  to make a complete exploration.
  
  @return the explored capabilities of the SSL/TLS
  connection