title: How to read SNI extension in Java?
body: <p>I want to find host name from <code>TLS Client Hello Message</code>. I want to find host name before java does complete handshake for transparent <code>ssl proxy</code>. </p>
  
  <p>Is there any way to find <code>SNI extension</code> value without writing whole <code>ssl handshake</code> logic ?</p>
  
  <p>Is Java supports <code>ssl handshake</code> with initial memory buffer ?
  My Idea is:</p>
  
  <ol>
  <li>Read TLS client hello message, parse it and find SNI value</li>
  <li>Call <code>sslSocket.startHandshake(initialBuffer)</code> Initial buffer will contain TLS client hello packet data. So Java can do handshake.</li>
  </ol>
  
  <p>Second Idea is to use <code>SSLEngine class</code>. But it seems a lot more implementation than requirement. I assume <code>SSLEngine</code> is used most of async in case which I don't require it.</p>
  
  <p>Third idea is to implement complete <code>TLS protocol</code>.</p>
  
  <p>Which idea is better ?</p>