title: How to tell if Java SSLSocket has data available?
body: <p>When I was using regular Sockets, I could call getInputStream() and use available() to see how many bytes were available. I switched to SSLSocket, but now available() always returns 0 for some reason. When I read instead, I can still get data. How can I tell if there is data available in an SSLSocket so that I can service it without blocking if there is no data?</p>
  
  <p>Notes:</p>
  
  <ul>
  <li>I cannot call read() on the InputStream or the thread will block. I would like non-blocking in my implementation.</li>
  <li>available() returns 0 even though there is data for SSLSocket's InputStream.</li>
  </ul>