title: HttpClient hangs when doing a second request
body: <p>I'm writing a java app that can login and shop around on the website. I'm having an issue where my HttpClient is hanging when I try to execute a second HttpResponse/Post. It was working fine before, not sure why it started hanging up. I don't get any errors, it just sits there and gets stuck. The only change I made that may be possibily causing this hang up is that I'm using HttpGet to retrieve tokens so I can login to the website.</p>
  
  <p>Here's how I'm setting up the httpClient</p>
  
  <pre><code>private static BasicCookieStore cookieStore = new BasicCookieStore();
  private static HttpClient httpClient = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
  </code></pre>
  
  <p>The rest is just a standard httpget &amp; httppost, then httpclient.execute(); </p>
  
  <p>The first sequence is my program queries the website and retrieves the token, then I send a POST with the token to sign in. After that my program queries a website again to get product information, then adds to the cart. But it hangs at the second POST.</p>
  
  <p>Could I be missing a flush somewhere? I was reading somewhere that this way of HttpClient closes itself. And the DefaultHttpClient has been deprecated. </p>