title: Android - HttpUrlConnection is not closing. Eventually results to SocketException
body: <p>I am encountering some problems with the HttpUrlConnection in devices running Jellybean (4.1 - 4.3) wherein connections are not closed and results to a SocketException "Too many open files" after executing a number of times. </p>
  
  <p>I do call HttpUrlConnection.disconnect() and am closing all the Inputstream, Outputstream, Reader and Writers in a finally block.</p>
  
  <p>Going to adb shell and executing a <code>netstat</code> shows all the connections created by the application are left in CLOSE_WAIT state.</p>
  
  <pre><code>InputStream inputStream = httpUrlConnection.getInputStream();
  
  // After calling inputStream.read() then the problem occurs. I think the 
  // inputstream doesn't get closed even after calling close in a finally block. 
  // The InputStream is a ChunkedInputStream if that helps.
  </code></pre>
  
  <p>I have tried other devices running on 2.3.3, 4.0.3 and 4.4 and did not encounter this issue.</p>
  
  <p>Is there another way that I can manually close the connections?</p>