title: HttpClient 4.0.1 - how to release connection?
body: <p>I have a loop over a bunch of URLs, for each one I'm doing the following:</p>
  
  <pre><code>private String doQuery(String url) {
  
    HttpGet httpGet = new HttpGet(url);
    setDefaultHeaders(httpGet); // static method
    HttpResponse response = httpClient.execute(httpGet);   // httpClient instantiated in constructor
  
    int rc = response.getStatusLine().getStatusCode();
  
    if (rc != 200) {
      // some stuff...
      return;
    }
  
    HttpEntity entity = response.getEntity();
  
    if (entity == null) {
      // some stuff...
      return;
    }
  
    // process the entity, get input stream etc
  
  }
  </code></pre>
  
  <p>The first query is fine, the second throws this exception:</p>
  
  <blockquote>
    <p>Exception in thread "main"
    java.lang.IllegalStateException:
    Invalid use of
    SingleClientConnManager: connection
    still allocated. Make sure to release
    the connection before allocating
    another one.  at
    org.apache.http.impl.conn.SingleClientConnManager.getConnection(SingleClientConnManager.java:199)
      at
    org.apache.http.impl.conn.SingleClientConnManager$1.getConnection(SingleClientConnManager.java:173)......</p>
  </blockquote>
  
  <p>This is just a simple single-threaded app. How can I release this connection?</p>