Setting the HTTP timeout for all HttpClients instead of just on send
This commit is contained in:
Christopher L. Shannon (cshannon) 2016-08-17 09:35:18 -04:00
parent d39fe372e5
commit 06e929f101
1 changed files with 4 additions and 2 deletions

View File

@ -124,8 +124,6 @@ public class HttpClientTransport extends HttpTransportSupport {
HttpResponse answer = null; HttpResponse answer = null;
try { try {
client = getSendHttpClient(); client = getSendHttpClient();
HttpParams params = client.getParams();
HttpConnectionParams.setSoTimeout(params, soTimeout);
answer = client.execute(httpMethod); answer = client.execute(httpMethod);
int status = answer.getStatusLine().getStatusCode(); int status = answer.getStatusLine().getStatusCode();
if (status != HttpStatus.SC_OK) { if (status != HttpStatus.SC_OK) {
@ -341,6 +339,10 @@ public class HttpClientTransport extends HttpTransportSupport {
new UsernamePasswordCredentials(getProxyUser(), getProxyPassword())); new UsernamePasswordCredentials(getProxyUser(), getProxyPassword()));
} }
} }
HttpParams params = client.getParams();
HttpConnectionParams.setSoTimeout(params, soTimeout);
return client; return client;
} }