restTemplate timeout

This commit is contained in:
DOHA 2016-01-11 13:52:52 +02:00 committed by David Morley
parent 556dee856a
commit 044a7f19e4
1 changed files with 9 additions and 0 deletions

View File

@ -243,4 +243,13 @@ public class RestTemplateLiveTest {
clientHttpRequest.getHeaders().add(HttpHeaders.AUTHORIZATION, "Basic " + getBase64EncodedLogPass()); clientHttpRequest.getHeaders().add(HttpHeaders.AUTHORIZATION, "Basic " + getBase64EncodedLogPass());
}; };
} }
// Simply setting restTemplate timeout using ClientHttpRequestFactory
ClientHttpRequestFactory getSimpleClientHttpRequestFactory() {
final int timeout = 5;
final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory();
clientHttpRequestFactory.setConnectTimeout(timeout * 1000);
return clientHttpRequestFactory;
}
} }