protected HttpClient newHttpClient ( ) { return HttpClients . custom ( ) // Do not manage redirection. . setRedirectStrategy ( new DefaultRedirectStrategy ( ) { @ Override protected boolean isRedirectable ( String method ) { return followRedirect ( method ) ; } } ) . setDefaultCookieStore ( new BasicCookieStore ( ) { @ Override public synchronized List < Cookie > getCookies ( ) { return Collections . emptyList ( ) ; } } ) . build ( ) ; }
Allows you do override the HTTP Client used to execute the requests . By default it used a custom client without cookies .