title: Apache HttpClient: setConnectTimeout() vs. setConnectionTimeToLive() vs. setSocketTimeout()
body: <p>Can someone please explain what is the difference between these two:</p>
  
  <pre><code>client = HttpClientBuilder.create()
      .setConnectionTimeToLive(1, TimeUnit.MINUTES)
      .build();
  </code></pre>
  
  <p>and</p>
  
  <pre><code>RequestConfig requestConfig = RequestConfig.custom().setConnectTimeout(30 * 1000).build();
  client = HttpClientBuilder
      .create()
      .setDefaultRequestConfig(requestConfig)
      .build();
  </code></pre>
  
  <p>Is it better to use <code>setSocketTimeout()</code>?</p>