title: Deprecated HttpClient, now using apache-httpclient-4.3.x
body: <p>I have code that works fine but its now deprecated. Everything is depricated except <code>BasicCredentialsProvider</code></p>
  
  <pre><code>SSLSocketFactory sslsf = new SSLSocketFactory("TLS", null, null, keyStore, null, new TrustSelfSignedStrategy(),
                  new AllowAllHostnameVerifier());
          Scheme https = new Scheme("https", 28181, sslsf);
  
          SchemeRegistry schemeRegistry = new SchemeRegistry();
          schemeRegistry.register(new Scheme("http", 80, PlainSocketFactory.getSocketFactory()));
          schemeRegistry.register(https);
  
          PoolingClientConnectionManager connectionManager = new PoolingClientConnectionManager(schemeRegistry);
          connectionManager.setMaxTotal(100);
          connectionManager.setDefaultMaxPerRoute(5);
  
          DefaultHttpClient httpClient = new DefaultHttpClient(connectionManager);
  
          BasicCredentialsProvider credsProvider = new BasicCredentialsProvider();
          credsProvider.setCredentials(new AuthScope(uri.getHost(), uri.getPort(), name),
                  new UsernamePasswordCredentials(username, password));
  
          httpClient.setCredentialsProvider(credsProvider);
          httpClient.getParams().setIntParameter(CoreConnectionPNames.SO_TIMEOUT, 60000);
  
          return new HttpContextRequestScopedApacheClientExecutor(httpClient);
  </code></pre>
  
  <p>I have tried to do it myself. First I replaced <code>SSLSocketFactory</code> with</p>
  
  <pre><code>    SSLConnectionSocketFactory sslConnectionFactory = new SSLConnectionSocketFactory
  (SSLContexts.custom().
                      loadTrustMaterial(keyStore, new TrustSelfSignedStrategy()).
  useTLS().build(), SSLConnectionSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER);
  </code></pre>
  
  <p>then I tried to use</p>
  
  <p><code>Registry&lt;ConnectionSocketFactory&gt; registry = RegistryBuilder.&lt;ConnectionSocketFactory&gt;create()
                      .register("https", sslConnectionFactory)
                      .build();</code></p>
  
  <p>I couldn't fit my port there, so I after searching for quite some time I am still lost on how to do it. And for the rest I have no solution yet. Any help on this would be apriciated.</p>