title: Socket InputStream blocks on available() / read()
body: <p>I'm reading Socket InputStream, calling read() and available() works for few looping iterations. Later available() blocks indefinitely!</p>
  
  <p>What could be the issue? How can I make this non-blocking?</p>
  
  <p>Code:</p>
  
  <pre><code>BufferedInputStream buffIn = new BufferedInputStream(in);
  while (true)
  {
      if (buffIn.available() &gt; 0)
      {
          len = buffIn.read(buffer, 0, buffer.length);
          if (len == -1)
          {
              break;
          }
          baos.write(buffer, 0, len);
      }
  }
  </code></pre>