title: SocketException: Bad file number. How can I solve it?
body: <p>I get a "SocketException: Bad file number" whenever I try to use a <code>BufferedReader</code> on a <code>HttpResponse</code>. 
  Basically I try to parse my response from the server. The strange thing is, that it only happens on my LG 2x (Android 2.2.2), I don't get this error on the Android Emulator (Google 2.2) and on a HTC (2.2).</p>
  
  <p><a href="https://stackoverflow.com/questions/5609688/android-what-is-a-bad-file-number-socketexception">In this thread someone explained why the error occurs.</a> But why is the problem only happening on the LG phone, and more importantly, how can I solve it?</p>
  
  <pre><code>HttpResponse response = JSONHelper.postJSONObject(WebSMSActivity.this, Consts
                                                  .api_url("settings"), json,
                                                  "Registration");
  
  // Read the response for the JSON reply
  try {
      BufferedReader in = new BufferedReader(
                  new InputStreamReader(response.getEntity().getContent(), "UTF-8"), 8 * 1024);
  
  
      // Read every line (should actually only be
      // one
      StringBuilder builder = new StringBuilder();
      for (String line = null; (line = in.readLine()) != null;) {
          builder.append(line).append("\n");
          Log.w(Consts.LOG_TAG_SERVICE, line);
      }
      String textResponse = builder.toString(); } catch (IOException ex) {}
  </code></pre>