@@ -206,19 +206,18 @@ private void initializeHttpClient() {
206206 }
207207
208208 private void initializeHttpPoolingClient () {
209- Registry <ConnectionSocketFactory > registry = createConnectionSocketFactoryRegistry ();
210- PoolingHttpClientConnectionManager httpConnectionManager = new PoolingHttpClientConnectionManager (registry );
211- httpConnectionManager .setMaxTotal (maximumPoolingConnections );
212- httpConnectionManager .setDefaultMaxPerRoute (maximumPoolingConnections );
213- AuthenticationStrategy authStrategy = new CookieProcessingTargetAuthenticationStrategy ();
214-
215- httpPoolingClient = HttpClients .custom ()
216- .setConnectionManager (httpConnectionManager )
217- .setTargetAuthenticationStrategy (authStrategy )
218- .build ();
219- }
220-
221-
209+ Registry <ConnectionSocketFactory > registry = createConnectionSocketFactoryRegistry ();
210+ PoolingHttpClientConnectionManager httpConnectionManager = new PoolingHttpClientConnectionManager (registry );
211+ httpConnectionManager .setMaxTotal (maximumPoolingConnections );
212+ httpConnectionManager .setDefaultMaxPerRoute (maximumPoolingConnections );
213+ AuthenticationStrategy authStrategy = new CookieProcessingTargetAuthenticationStrategy ();
214+
215+ httpPoolingClient = HttpClients .custom ()
216+ .setConnectionManager (httpConnectionManager )
217+ .setTargetAuthenticationStrategy (authStrategy )
218+ .build ();
219+ }
220+
222221 /**
223222 * Sets the maximum number of connections for the pooling connection manager which is used for
224223 * subscriptions.
@@ -344,26 +343,27 @@ protected HttpWebRequest prepareHttpWebRequestForUrl(URI url, boolean acceptGzip
344343 * @throws java.net.URISyntaxException the uRI syntax exception
345344 */
346345 protected HttpWebRequest prepareHttpPoolingWebRequestForUrl (URI url , boolean acceptGzipEncoding ,
347- boolean allowAutoRedirect ) throws ServiceLocalException , URISyntaxException {
348- // Verify that the protocol is something that we can handle
349- String scheme = url .getScheme ();
350- if (!scheme .equalsIgnoreCase (EWSConstants .HTTP_SCHEME )
351- && !scheme .equalsIgnoreCase (EWSConstants .HTTPS_SCHEME )) {
352- String strErr = String .format ("Protocol %s isn't supported for service request." , scheme );
353- throw new ServiceLocalException (strErr );
354- }
355-
356- if (httpPoolingClient == null )
357- initializeHttpPoolingClient ();
358- HttpClientWebRequest request = new HttpClientWebRequest (httpPoolingClient , httpContext );
359- prepareHttpWebRequestForUrl (url , acceptGzipEncoding , allowAutoRedirect , request );
360-
361- return request ;
362- }
363-
364- private void prepareHttpWebRequestForUrl (URI url , boolean acceptGzipEncoding , boolean allowAutoRedirect , HttpClientWebRequest request )
365- throws ServiceLocalException , URISyntaxException
366- {
346+ boolean allowAutoRedirect ) throws ServiceLocalException , URISyntaxException {
347+ // Verify that the protocol is something that we can handle
348+ String scheme = url .getScheme ();
349+ if (!scheme .equalsIgnoreCase (EWSConstants .HTTP_SCHEME )
350+ && !scheme .equalsIgnoreCase (EWSConstants .HTTPS_SCHEME )) {
351+ String strErr = String .format ("Protocol %s isn't supported for service request." , scheme );
352+ throw new ServiceLocalException (strErr );
353+ }
354+
355+ if (httpPoolingClient == null ) {
356+ initializeHttpPoolingClient ();
357+ }
358+
359+ HttpClientWebRequest request = new HttpClientWebRequest (httpPoolingClient , httpContext );
360+ prepareHttpWebRequestForUrl (url , acceptGzipEncoding , allowAutoRedirect , request );
361+
362+ return request ;
363+ }
364+
365+ private void prepareHttpWebRequestForUrl (URI url , boolean acceptGzipEncoding , boolean allowAutoRedirect ,
366+ HttpClientWebRequest request ) throws ServiceLocalException , URISyntaxException {
367367 try {
368368 request .setUrl (url .toURL ());
369369 } catch (MalformedURLException e ) {
0 commit comments