code: public static int getRequiredSize(byte[] source,
              int offset, int length) throws IOException {
  
          ByteBuffer byteBuffer =
              ByteBuffer.wrap(source, offset, length).asReadOnlyBuffer();
          return getRequiredSize(byteBuffer);
      }
docs: Returns the required number of bytes in the {@code source} byte array
  necessary to explore SSL/TLS connection.
  <P>
  This method tries to parse as few bytes as possible from
  {@code source} byte array to get the length of an
  SSL/TLS record.
  
  @param  source
  a byte array containing inbound or outbound network data for
  an SSL/TLS connection.
  @param  offset
  the start offset in array {@code source} at which the
  network data is read from.
  @param  length
  the maximum number of bytes to read.
  
  @throws BufferUnderflowException if less than {@code RECORD_HEADER_SIZE}
  bytes remaining in {@code source}
  @return the required size in byte to explore an SSL/TLS connection