title: How to force Commons HTTPClient 3.1 to use TLS 1.2 only for HTTPS?
body: <p>I wish to force <em>Apache Commons <strong>HTTP-Client</em></strong> (version <strong>3.1</strong>) to use <strong>TLS 1.2</strong> as the <strong><em>only</em></strong> protocol for HTTPS.</p>
  
  <p>This is due to the server supposedly being upgraded to TLS 1.2 and not accepting any older protocol anymore (causing 'Connection Reset' to be returned).</p>
  
  <p>For further context, probably irrelevant, the HTTP-Client is used along with Axis2 to make a SOAP; some of the code used for setting up the HttpClient is below:</p>
  
  <pre><code>MultiThreadedHttpConnectionManager connMgr = new MultiThreadedHttpConnectionManager();
  this.httpClient = new HttpClient(connMgr);
  
  // initialize HttpClient parameters
  HttpClientParams hcParams = this.httpClient.getParams();
  
  // Maximum time to wait to receive connection from pool
  hcParams.setConnectionManagerTimeout(this.maxWait);
  hcParams.setSoTimeout(this.timeout);
  hcParams.setParameter(HttpMethodParams.RETRY_HANDLER, new DefaultHttpMethodRetryHandler(this.retryCount, false));
  
  // Initialize global Connection manager parameters
  HttpConnectionManagerParams cmParams = connMgr.getParams();
  cmParams.setDefaultMaxConnectionsPerHost(this.maxActive);
  cmParams.setStaleCheckingEnabled(this.checkStaleConnections);
  cmParams.setConnectionTimeout(this.timeout);
  </code></pre>
  
  <p>Thanks a lot for the help!</p>