title: Configuring Apache HttpClientBuilder to have timeout and cookies
body: <p>I used the code from <a href="http://www.baeldung.com/httpclient-4-cookies" rel="nofollow">this tutorial</a> to send cookies in my HttpClient request, and the code from <a href="http://www.baeldung.com/httpclient-timeout" rel="nofollow">this tutorial</a> to set timeouts for the same HttpClient. Problem is setting the cookie store is done when the HttpClient is built from the HttpClientBuilder...</p>
  
  <pre><code>HttpClient client = HttpClientBuilder.create().setDefaultCookieStore(cookieStore).build();
  </code></pre>
  
  <p>But setting the RequestConfig with the timeouts also seems to happen at the same place....</p>
  
  <pre><code>CloseableHttpClient client = HttpClientBuilder.create().setDefaultRequestConfig(config).build();
  </code></pre>
  
  <p>So how can I create an HttpClient while doing both (setting a cookie stores and request config with timeouts)?</p>