restTemplate timeout

This commit is contained in:
DOHA 2016-01-11 13:52:52 +02:00
parent f060700cec
commit 33d51f7773
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());
};
}
// Simply setting restTemplate timeout using ClientHttpRequestFactory
ClientHttpRequestFactory getSimpleClientHttpRequestFactory() {
final int timeout = 5;
final HttpComponentsClientHttpRequestFactory clientHttpRequestFactory = new HttpComponentsClientHttpRequestFactory();
clientHttpRequestFactory.setConnectTimeout(timeout * 1000);
return clientHttpRequestFactory;
}
}