List of usage examples for org.apache.http.conn.params ConnPerRouteBean ConnPerRouteBean
public ConnPerRouteBean(final int defaultMax)
From source file:com.example.wechatsample.library.http.AsyncHttpClient.java
/** * Creates a new AsyncHttpClient./*from ww w . j a v a 2s .c o m*/ */ public AsyncHttpClient() { BasicHttpParams httpParams = new BasicHttpParams(); ConnManagerParams.setTimeout(httpParams, socketTimeout); ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(maxConnections)); ConnManagerParams.setMaxTotalConnections(httpParams, DEFAULT_MAX_CONNECTIONS); HttpConnectionParams.setSoTimeout(httpParams, socketTimeout); HttpConnectionParams.setConnectionTimeout(httpParams, socketTimeout); HttpConnectionParams.setTcpNoDelay(httpParams, true); HttpConnectionParams.setSocketBufferSize(httpParams, DEFAULT_SOCKET_BUFFER_SIZE); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setUserAgent(httpParams, String.format("android-async-http/%s (http://loopj.com/android-async-http)", VERSION)); ThreadSafeClientConnManager cm = null; try { // https? KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null, null); SSLSocketFactory sf = new SSLSocketFactoryEx(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); // ?? SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", sf, 443)); schemeRegistry.register(new Scheme("https", sf, 8443)); cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry); } catch (KeyManagementException e) { e.printStackTrace(); } catch (UnrecoverableKeyException e) { e.printStackTrace(); } catch (KeyStoreException e) { e.printStackTrace(); } catch (NoSuchAlgorithmException e) { e.printStackTrace(); } catch (CertificateException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } httpContext = new SyncBasicHttpContext(new BasicHttpContext()); httpClient = new DefaultHttpClient(cm, httpParams); httpClient.addRequestInterceptor(new HttpRequestInterceptor() { public void process(HttpRequest request, HttpContext context) { if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); } for (String header : clientHeaderMap.keySet()) { request.addHeader(header, clientHeaderMap.get(header)); } } }); httpClient.addResponseInterceptor(new HttpResponseInterceptor() { public void process(HttpResponse response, HttpContext context) { final HttpEntity entity = response.getEntity(); if (entity == null) { return; } final Header encoding = entity.getContentEncoding(); if (encoding != null) { for (HeaderElement element : encoding.getElements()) { if (element.getName().equalsIgnoreCase(ENCODING_GZIP)) { response.setEntity(new InflatingEntity(response.getEntity())); break; } } } } }); httpClient.setHttpRequestRetryHandler(new RetryHandler(DEFAULT_MAX_RETRIES)); threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool(); requestMap = new WeakHashMap<Context, List<WeakReference<Future<?>>>>(); clientHeaderMap = new HashMap<String, String>(); }
From source file:com.revo.deployr.client.core.impl.RClientImpl.java
public RClientImpl(String serverurl, int concurrentCallLimit, boolean allowSelfSignedSSLCert) throws RClientException, RSecurityException { log.debug("Creating client connection: serverurl=" + serverurl + ", concurrentCallLimit=" + concurrentCallLimit + ", allowSelfSignedSSLCert=" + allowSelfSignedSSLCert); this.serverurl = serverurl; // Create and initialize HTTP parameters HttpParams httpParams = new BasicHttpParams(); // Set Infinite Connection and Socket Timeouts. HttpConnectionParams.setConnectionTimeout(httpParams, 0); HttpConnectionParams.setSoTimeout(httpParams, 0); ConnManagerParams.setMaxTotalConnections(httpParams, concurrentCallLimit); ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(concurrentCallLimit)); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); // Create and initialize scheme registry SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); if (allowSelfSignedSSLCert) { /*//from w w w. ja v a 2 s .c o m * Register scheme for "https" that bypasses * SSL cert trusted-origin verification check * which makes it possible to connect to a * DeployR server using a self-signed certificate. * * Recommended for prototyping and testing only, * not recommended for production environments. */ TrustStrategy blindTrust = new TrustStrategy() { @Override public boolean isTrusted(X509Certificate[] certificate, String authType) { return true; } }; try { sslSocketFactory = new SSLSocketFactory(blindTrust, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); schemeRegistry.register(new Scheme("https", 8443, sslSocketFactory)); } catch (GeneralSecurityException gsex) { String exMsg = "Self-signed SSL cert config failed, " + gsex.getMessage(); log.debug(exMsg); throw new RSecurityException(exMsg, 0); } } // Create a HttpClient with the ThreadSafeClientConnManager. // This connection manager must be used if more than one thread will // be using the HttpClient. ClientConnectionManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry); httpClient = new DefaultHttpClient(cm, httpParams); // Enable cookie handling by setting cookie policy on HttpClient. httpClient.getParams().setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BEST_MATCH); log.debug("Created client connection: httpClient=" + httpClient); eService = Executors.newCachedThreadPool(); }
From source file:org.gege.caldavsyncadapter.caldav.CaldavFacade.java
protected HttpClient getHttpClient() { HttpParams params = new BasicHttpParams(); params.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 30); params.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(30)); params.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false); HttpProtocolParams.setVersion(params, HttpVersion.HTTP_1_1); SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", new PlainSocketFactory(), 80)); registry.register(new Scheme("https", (trustAll ? EasySSLSocketFactory.getSocketFactory() : SSLSocketFactory.getSocketFactory()), 443)); DefaultHttpClient client = new DefaultHttpClient(new ThreadSafeClientConnManager(params, registry), params); return client; }
From source file:lynxtools.async_download.AsyncHttpClient.java
/** * Creates a new AsyncHttpClient.//from ww w . j a v a 2 s .c om */ public AsyncHttpClient() { BasicHttpParams httpParams = new BasicHttpParams(); ConnManagerParams.setTimeout(httpParams, socketTimeout); ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(maxConnections)); ConnManagerParams.setMaxTotalConnections(httpParams, DEFAULT_MAX_CONNECTIONS); HttpConnectionParams.setSoTimeout(httpParams, socketTimeout); HttpConnectionParams.setConnectionTimeout(httpParams, socketTimeout); HttpConnectionParams.setTcpNoDelay(httpParams, true); HttpConnectionParams.setSocketBufferSize(httpParams, DEFAULT_SOCKET_BUFFER_SIZE); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setUserAgent(httpParams, String.format("android-async-http/%s (http://loopj.com/android-async-http)", VERSION)); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); if (AsyncWraper.getTrustAllCertificates()) { try { //accepting all certificates because fuck this. KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType()); trustStore.load(null, null); SSLSocketFactory sf = new MySSLSocketFactory(trustStore); sf.setHostnameVerifier(SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER); schemeRegistry.register(new Scheme("https", sf, 443)); System.out.println("accepting all certificates"); } catch (Exception e) { e.printStackTrace(); } } else { schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); } ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry); httpContext = new SyncBasicHttpContext(new BasicHttpContext()); httpClient = new DefaultHttpClient(cm, httpParams); httpClient.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) { if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); } for (String header : clientHeaderMap.keySet()) { request.addHeader(header, clientHeaderMap.get(header)); } } }); httpClient.addResponseInterceptor(new HttpResponseInterceptor() { @Override public void process(HttpResponse response, HttpContext context) { final HttpEntity entity = response.getEntity(); if (entity == null) { return; } final Header encoding = entity.getContentEncoding(); if (encoding != null) { for (HeaderElement element : encoding.getElements()) { if (element.getName().equalsIgnoreCase(ENCODING_GZIP)) { response.setEntity(new InflatingEntity(response.getEntity())); break; } } } } }); httpClient.setHttpRequestRetryHandler(new RetryHandler(DEFAULT_MAX_RETRIES)); threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool(); clientHeaderMap = new HashMap<String, String>(); }
From source file:pl.xsolve.verfluchter.rest.RestClient.java
private RestResponse executeRequest(HttpUriRequest request) throws IOException { Log.v(TAG, "Final request preperations..."); HttpParams httpParams = new BasicHttpParams(); httpParams.setParameter(ConnManagerPNames.MAX_TOTAL_CONNECTIONS, 1); httpParams.setParameter(ConnManagerPNames.MAX_CONNECTIONS_PER_ROUTE, new ConnPerRouteBean(1)); httpParams.setParameter(HttpProtocolParams.USE_EXPECT_CONTINUE, false); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setContentCharset(httpParams, Charsets.UTF_8.name()); context = new BasicHttpContext(); // if (basicAuthCredentials != null) { // ignore that the ssl cert is self signed CredentialsProvider credentialsProvider = new BasicCredentialsProvider(); credentialsProvider.setCredentials(new AuthScope(null, AuthScope.ANY_PORT), // null here means "any host is OK" new UsernamePasswordCredentials(basicAuthCredentials.first, basicAuthCredentials.second)); clientConnectionManager = new ThreadSafeClientConnManager(httpParams, schemeRegistry); context.setAttribute("http.auth.credentials-provider", credentialsProvider); // }// w w w . j a v a2s. com //connection (client has to be created for every new connection) httpclient = new DefaultHttpClient(clientConnectionManager, httpParams); for (Cookie cookie : cookies) { Log.v(TAG, "Using cookie " + cookie.getName() + "=" + cookie.getValue() + "..."); httpclient.getCookieStore().addCookie(cookie); } try { httpResponse = httpclient.execute(request, context); int responseCode = httpResponse.getStatusLine().getStatusCode(); Header[] headers = httpResponse.getAllHeaders(); String errorMessage = httpResponse.getStatusLine().getReasonPhrase(); HttpEntity entity = httpResponse.getEntity(); Log.v(TAG, "Got cookies:"); cookies = httpclient.getCookieStore().getCookies(); if (cookies.isEmpty()) { Log.v(TAG, "None"); } else { for (Cookie cookie : cookies) { Log.v(TAG, "---- " + cookie.toString()); } } String message = null; InputStream inStream = entity.getContent(); message = SoulTools.convertStreamToString(inStream); // Closing the input stream will trigger connection release entity.consumeContent(); inStream.close(); return new RestResponse(responseCode, message, headers, cookies, errorMessage); } catch (ClientProtocolException e) { Log.v(TAG, "Encountered ClientProtocolException!"); e.printStackTrace(); } catch (IOException e) { Log.v(TAG, "Encountered IOException!"); e.printStackTrace(); } finally { //always shutdown the connection manager httpclient.getConnectionManager().shutdown(); } Log.v(TAG, "Returning null RestResponse!"); return null; }
From source file:com.pyj.http.AsyncHttpClient.java
/** * Creates a new AsyncHttpClient./*from w w w . j a va2 s. c om*/ */ public AsyncHttpClient() { BasicHttpParams httpParams = new BasicHttpParams(); ConnManagerParams.setTimeout(httpParams, socketTimeout); ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(maxConnections)); ConnManagerParams.setMaxTotalConnections(httpParams, DEFAULT_MAX_CONNECTIONS); HttpConnectionParams.setSoTimeout(httpParams, socketTimeout); HttpConnectionParams.setConnectionTimeout(httpParams, socketTimeout); HttpConnectionParams.setTcpNoDelay(httpParams, true); HttpConnectionParams.setSocketBufferSize(httpParams, DEFAULT_SOCKET_BUFFER_SIZE); // ?cookie httpParams.setParameter(ClientPNames.COOKIE_POLICY, CookiePolicy.BROWSER_COMPATIBILITY); // httpParams.setParameter(ClientPNames.COOKIE_POLICY, "hupu.com"); httpParams.setParameter(CookieSpecPNames.SINGLE_COOKIE_HEADER, true); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); if (Build.VERSION.SDK != null && Build.VERSION.SDK_INT > 13) { httpParams.setParameter("Connection", "close"); } // HttpProtocolParams.setUserAgent(httpParams, // String.format("android-async-http/%s (http://loopj.com/android-async-http)", // VERSION)); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); // SSLSocketFactory ssl=getSSLSocketFactory(); // schemeRegistry.register(new Scheme("https", ssl, 443)); ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry); httpContext = new SyncBasicHttpContext(new BasicHttpContext()); httpClient = new DefaultHttpClient(cm, httpParams); httpClient.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) { if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); } if (!request.containsHeader("")) for (String header : clientHeaderMap.keySet()) { request.addHeader(header, clientHeaderMap.get(header)); } } }); httpClient.addResponseInterceptor(new HttpResponseInterceptor() { @Override public void process(HttpResponse response, HttpContext context) { final HttpEntity entity = response.getEntity(); if (entity == null) { return; } final Header encoding = entity.getContentEncoding(); if (encoding != null) { for (HeaderElement element : encoding.getElements()) { // HupuLog.d("ResponseInterceptor", // "key="+element.getName()+" value="+element.getValue()); if (element.getName().equalsIgnoreCase(ENCODING_GZIP)) { // HupuLog.d("ResponseInterceptor", "gzip"); response.setEntity(new InflatingEntity(response.getEntity())); // continue; } } } Header[] headers = response.getHeaders(HEADER_DATE); if (headers != null) { for (int i = 0; i < headers.length; i++) { if (headers[i].getName().equalsIgnoreCase(HEADER_DATE)) { Date date = new java.util.Date(headers[i].getValue()); today = date.getTime(); // Calendar cal = new GregorianCalendar(); } } } } }); httpClient.setHttpRequestRetryHandler(new RetryHandler(DEFAULT_MAX_RETRIES)); threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool(); requestMap = new WeakHashMap<Context, List<WeakReference<Future<?>>>>(); clientHeaderMap = new HashMap<String, String>(); // CookieStore cookieStore = new BasicCookieStore(); // setCookieStore(cookieStore); }
From source file:mobi.dlys.android.core.net.http.client.AsyncHttpClient.java
/** * Creates a new AsyncHttpClient./*from w ww. j av a 2 s . c om*/ * * @throws NoSuchAlgorithmException * @throws KeyManagementException * @throws KeyStoreException * @throws UnrecoverableKeyException */ public AsyncHttpClient() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException, UnrecoverableKeyException { BasicHttpParams httpParams = new BasicHttpParams(); ConnManagerParams.setTimeout(httpParams, socketTimeout); ConnManagerParams.setMaxConnectionsPerRoute(httpParams, new ConnPerRouteBean(maxConnections)); ConnManagerParams.setMaxTotalConnections(httpParams, DEFAULT_MAX_CONNECTIONS); HttpConnectionParams.setSoTimeout(httpParams, socketTimeout); HttpConnectionParams.setConnectionTimeout(httpParams, socketTimeout); HttpConnectionParams.setTcpNoDelay(httpParams, true); HttpConnectionParams.setSocketBufferSize(httpParams, DEFAULT_SOCKET_BUFFER_SIZE); HttpProtocolParams.setVersion(httpParams, HttpVersion.HTTP_1_1); HttpProtocolParams.setUserAgent(httpParams, String.format("android-async-http/%s (http://loopj.com/android-async-http)", VERSION)); KeyStore keyStroe = KeyStore.getInstance(KeyStore.getDefaultType()); SSLSocketFactory ssf = new ClientSSLSocketFactory(keyStroe); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", ssf, 443)); ThreadSafeClientConnManager cm = new ThreadSafeClientConnManager(httpParams, schemeRegistry); httpContext = new SyncBasicHttpContext(new BasicHttpContext()); httpClient = new DefaultHttpClient(cm, httpParams); httpClient.addRequestInterceptor(new HttpRequestInterceptor() { @Override public void process(HttpRequest request, HttpContext context) { if (!request.containsHeader(HEADER_ACCEPT_ENCODING)) { request.addHeader(HEADER_ACCEPT_ENCODING, ENCODING_GZIP); } for (String header : clientHeaderMap.keySet()) { request.addHeader(header, clientHeaderMap.get(header)); } } }); httpClient.addResponseInterceptor(new HttpResponseInterceptor() { @Override public void process(HttpResponse response, HttpContext context) { final HttpEntity entity = response.getEntity(); if (entity == null) { return; } final Header encoding = entity.getContentEncoding(); if (encoding != null) { for (HeaderElement element : encoding.getElements()) { if (element.getName().equalsIgnoreCase(ENCODING_GZIP)) { response.setEntity(new InflatingEntity(response.getEntity())); break; } } } } }); httpClient.setHttpRequestRetryHandler(new RetryHandler(DEFAULT_MAX_RETRIES)); // threadPool = (ThreadPoolExecutor) Executors.newCachedThreadPool(); threadPool = ThreadPool.getInstance().getDefaultThreadPoolExecutor(); // threadPool = new ThreadPoolExecutor(10, 30, 60, TimeUnit.SECONDS, new // LinkedBlockingQueue<Runnable>()); requestMap = new WeakHashMap<Context, List<WeakReference<Future<?>>>>(); clientHeaderMap = new HashMap<String, String>(); }
From source file:com.duokan.reader.domain.account.oauth.evernote.TEvernoteHttpClient.java
private DefaultHttpClient getHTTPClient() { try {/*from w w w.j ava 2 s .c o m*/ if (mConnectionManager != null) { mConnectionManager.closeExpiredConnections(); mConnectionManager.closeIdleConnections(1, TimeUnit.SECONDS); } else { BasicHttpParams params = new BasicHttpParams(); HttpConnectionParams.setConnectionTimeout(params, 10000); HttpConnectionParams.setSoTimeout(params, 20000); ConnManagerParams.setMaxTotalConnections(params, ConnManagerParams.DEFAULT_MAX_TOTAL_CONNECTIONS); ConnManagerParams.setTimeout(params, 10000); ConnPerRouteBean connPerRoute = new ConnPerRouteBean(18); // Giving 18 connections to Evernote ConnManagerParams.setMaxConnectionsPerRoute(params, connPerRoute); SchemeRegistry schemeRegistry = new SchemeRegistry(); schemeRegistry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); schemeRegistry.register(new Scheme("https", SSLSocketFactory.getSocketFactory(), 443)); mConnectionManager = new ThreadSafeClientConnManager(params, schemeRegistry); DefaultHttpClient httpClient = new DefaultHttpClient(mConnectionManager, params); httpClient.setKeepAliveStrategy(new ConnectionKeepAliveStrategy() { @Override public long getKeepAliveDuration(HttpResponse response, HttpContext context) { return 2 * 60 * 1000; // 2 minutes in millis } }); httpClient.setReuseStrategy(new ConnectionReuseStrategy() { @Override public boolean keepAlive(HttpResponse response, HttpContext context) { return true; } }); mHttpClient = httpClient; } } catch (Exception ex) { return null; } return mHttpClient; }
From source file:com.sun.identity.proxy.client.ClientHandler.java
/** * Creates a new client handler with the specified maximum number of * connections.//from www . j a v a 2s . c o m * * @param connections the maximum number of connections to open. */ public ClientHandler(int connections) { BasicHttpParams parameters = new BasicHttpParams(); ConnManagerParams.setMaxTotalConnections(parameters, connections); ConnManagerParams.setMaxConnectionsPerRoute(parameters, new ConnPerRouteBean(connections)); HttpProtocolParams.setVersion(parameters, HttpVersion.HTTP_1_1); HttpClientParams.setRedirecting(parameters, false); SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); registry.register(new Scheme("https", newSSLSocketFactory(), 443)); ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(parameters, registry); httpClient = new DefaultHttpClient(connectionManager, parameters); httpClient.removeRequestInterceptorByClass(RequestAddCookies.class); httpClient.removeRequestInterceptorByClass(RequestProxyAuthentication.class); httpClient.removeRequestInterceptorByClass(RequestTargetAuthentication.class); httpClient.removeResponseInterceptorByClass(ResponseProcessCookies.class); // TODO: set timeout to drop stalled connections? // FIXME: prevent automatic retry by apache httpclient }
From source file:org.forgerock.openig.handler.ClientHandler.java
/** * Creates a new client handler with the specified maximum number of * connections.// ww w.j a va 2s. c om * * @param connections the maximum number of connections to open. */ public ClientHandler(int connections, TemporaryStorage storage) { this.storage = storage; BasicHttpParams parameters = new BasicHttpParams(); ConnManagerParams.setMaxTotalConnections(parameters, connections); ConnManagerParams.setMaxConnectionsPerRoute(parameters, new ConnPerRouteBean(connections)); HttpProtocolParams.setVersion(parameters, HttpVersion.HTTP_1_1); HttpClientParams.setRedirecting(parameters, false); SchemeRegistry registry = new SchemeRegistry(); registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80)); registry.register(new Scheme("https", newSSLSocketFactory(), 443)); ClientConnectionManager connectionManager = new ThreadSafeClientConnManager(parameters, registry); httpClient = new DefaultHttpClient(connectionManager, parameters); httpClient.removeRequestInterceptorByClass(RequestAddCookies.class); httpClient.removeRequestInterceptorByClass(RequestProxyAuthentication.class); httpClient.removeRequestInterceptorByClass(RequestTargetAuthentication.class); httpClient.removeResponseInterceptorByClass(ResponseProcessCookies.class); // TODO: set timeout to drop stalled connections? // FIXME: prevent automatic retry by apache httpclient }