httpproc.addInterceptor(new RequestConnControl());
httpproc.addInterceptor(new RequestUserAgent());
httpproc.addInterceptor(new RequestExpectContinue());
// Set up protocol handler
BufferingHttpClientHandler protocolHandler = new BufferingHttpClientHandler(
httpproc,
new MyHttpRequestExecutionHandler(),
new DefaultConnectionReuseStrategy(),
params);
protocolHandler.setEventListener(new EventLogger());
// Limit the total maximum of concurrent connections to 5
int maxTotalConnections = 5;
// Use the connection manager to maintain a pool of connections to localhost:8080