connectionManager = localConnectionManager;
int socketTimeout = 900000;
int connectionTimeout = 60000;
BasicHttpParams params = new BasicHttpParams();
// This one is essential to prevent us from reading from the content stream before necessary during auth, but
// is incompatible with some proxies.
params.setBooleanParameter(CoreProtocolPNames.USE_EXPECT_CONTINUE,true);
// Enabled for Solr, but probably not necessary for better-behaved ES
//params.setBooleanParameter(CoreConnectionPNames.TCP_NODELAY,true);
params.setBooleanParameter(CoreConnectionPNames.STALE_CONNECTION_CHECK,true);
params.setBooleanParameter(ClientPNames.ALLOW_CIRCULAR_REDIRECTS,true);
params.setIntParameter(CoreConnectionPNames.SO_TIMEOUT,socketTimeout);
params.setIntParameter(CoreConnectionPNames.CONNECTION_TIMEOUT,connectionTimeout);
params.setBooleanParameter(ClientPNames.HANDLE_REDIRECTS,true);
DefaultHttpClient localClient = new DefaultHttpClient(connectionManager,params);
// No retries
localClient.setHttpRequestRetryHandler(new HttpRequestRetryHandler()
{
public boolean retryRequest(