1

I send http requests over Apache HttpClient and my code is here:

 HttpHost proxy = new HttpHost("78.1.1.222", 80); DefaultProxyRoutePlanner routePlanner = new DefaultProxyRoutePlanner(proxy); httpClient = HttpClients.custom() .setRoutePlanner(routePlanner) .build(); HttpGet httpGet = new HttpGet(url); httpGet.addHeader("Authorization","Basic " + encoding); httpGet.addHeader("Cache-Control", "no-cache"); httpResponse = httpClient.execute(httpGet); responseCode=httpResponse.getStatusLine().getStatusCode(); ........ ........(code continue..) 

My question is that how can I add connection timeout time to this code? Note that I must use proxy with that and I use HttpClient 4.4 .

1
  • 1
    Have you checked the Apache HttpClient documentation? Does it have a suitable method? Commented Nov 4, 2015 at 20:31

1 Answer 1

3

http://www.baeldung.com/httpclient-timeout explains various ways to set the connection timeout.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.