title: Only two parallel https calls are going outside with SSLConnectionSocketFactory
body: <p>When I I am making outgoing requests with SSLConnectionSocketFactory request factory, only two parallel outgoing calls are getting response at a time. Subsequent calls reaches outside endpoint only when first two requests finish responding.</p>
  
  <p>This is the RestTemplate config,</p>
  
  <pre><code>private RestTemplate createSSLRestTemplate(String keyStorePath, String keyStorePassword) throws KeyStoreException, IOException, NoSuchAlgorithmException, CertificateException, KeyManagementException, UnrecoverableKeyException {
      KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
      keyStore.load(new ClassPathResource(keyStorePath).getInputStream(), keyStorePassword.toCharArray());
  
      SSLConnectionSocketFactory socketFactory = new SSLConnectionSocketFactory(
              new SSLContextBuilder()
                      .loadTrustMaterial(null, new TrustSelfSignedStrategy())
                      .loadKeyMaterial(keyStore, keyStorePassword.toCharArray())
                      .build(),
              NoopHostnameVerifier.INSTANCE);
  
      HttpClient httpClient = HttpClients.custom().setSSLSocketFactory(
              socketFactory).build();
  
      ClientHttpRequestFactory requestFactory = new HttpComponentsClientHttpRequestFactory(
              httpClient);
      BufferingClientHttpRequestFactory bufferingRequestFactory = new BufferingClientHttpRequestFactory(requestFactory);
      RestTemplate restTemplate = new RestTemplate(bufferingRequestFactory);
      restTemplate.setInterceptors(Collections.singletonList(restTemplateLoggingInterceptor));
      return restTemplate;
  }
  </code></pre>
  
  <p>However if I replaced the RestTemplate with simple RestTeamplate all the calls goes to outside and responds in parallel.</p>
  
  <pre><code>public RestTemplate restTemplateDefault() {
      return new RestTemplate();
  }
  </code></pre>
  
  <p>Code that make the outgoing http request</p>
  
  <pre><code>HttpEntity&lt;Req&gt; request = new HttpEntity(req, this.prepareHttpHeaders());
          return this.xmlUnmarshaller.unmarshall((String)this.restTemplate.postForObject(host, request, String.class, new Object[0]), responseClass);
  </code></pre>
  
  <p>How do I have sslcontext and have achieve parallelism?</p>