title: Alternatives to Apache HttpComponents?
body: <p>So, I've come to the conclusion that Apache HttpComponents 4 is one of the most overwrought APIs I've ever come across.  Things that seem like they should be simple are taking hundreds of lines of code (and I'm <em>still</em> not sure resources get cleaned up correctly).</p>
  
  <p>Plus it wants me to do things like:</p>
  
  <pre><code>List&lt;NameValuePair&gt; qparams = new ArrayList&lt;NameValuePair&gt;();
  qparams.add(new BasicNameValuePair("q", "httpclient"));
  qparams.add(new BasicNameValuePair("btnG", "Google Search"));
  qparams.add(new BasicNameValuePair("aq", "f"));
  qparams.add(new BasicNameValuePair("oq", null));
  URI uri = URIUtils.createURI("http", "www.google.com", -1, "/search", 
    URLEncodedUtils.format(qparams, "UTF-8"), null);
  </code></pre>
  
  <p>Which, just... no. I know it's Java, and we're not into the whole brevity thing, but that's a little much. Not to mention the jars are up to 700KB.</p>
  
  <p>Anyway, enough ranting, I wanted to see what kind of experiences people have had with other HTTP client libraries?</p>
  
  <p>The ones I'm aware of are: <a href="http://docs.codehaus.org/display/JETTY/Jetty+HTTP+Client" rel="noreferrer">Jetty</a>, <a href="http://hotpotato.biasedbit.com/" rel="noreferrer">hotpotato</a>, and <a href="https://github.com/sonatype/async-http-client" rel="noreferrer">AsyncHttpClient</a>.</p>
  
  <p>This is for server-side use, I'm mostly interested in performance for many concurrent gets and large file transfers.</p>
  
  <p>Any recommendations?</p>
  
  <p>PS I know the venerable HttpClient 3.1 is still there, but I'd like to use something that's supported.</p>
  
  <h3>Update</h3>
  
  <p>@oleg: this is what the docs suggest:</p>
  
  <pre><code>    HttpClient httpclient = new DefaultHttpClient();
      try {
          HttpGet httpget = new HttpGet("http://www.apache.org/");
          HttpResponse response = httpclient.execute(httpget);
          HttpEntity entity = response.getEntity();
          if (entity != null) {
              InputStream instream = entity.getContent();
              try {
                  instream.read();
              } catch (IOException ex) {
                  throw ex;
              } catch (RuntimeException ex) {
                  httpget.abort();
                  throw ex;
              } finally {
                  try { instream.close(); } catch (Exception ignore) {}
              }
          }
      } finally {
          httpclient.getConnectionManager().shutdown();
      }
  </code></pre>
  
  <p>I still get unexpected errors when consuming entity content when using <code>ThreadSafeClientConnManager</code>. I'm sure it's my fault, but at this point I don't really want to have to figure it out.</p>
  
  <p>Hey, I don't mean to disparage anyone's work here, but I've been making a good-faith effort to use HttpComponents since 4.0 came out and it's just not working for me.</p>