hc-httpclient-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Oleg Kalnichevski <ol...@apache.org>
Subject Re: how to config the ip of the site?
Date Thu, 23 Oct 2014 09:16:15 GMT
On Thu, 2014-10-23 at 15:07 +0800, 风 wrote:
> hi All:
> i want to config the ip of the request, how to do?
> 
> 
> for example:
> HttpGet httpGet = new HttpGet("https://www.google.com/");
> httpClient.execute(httpGet);
> 
> 
> in this way, httpClient will config the google's ip autoly. but i want to config the
google's ip in my self. 
> i want httpclient to visit google in the ip: 2.2.2.2. how to do? 
> 

HttpHost target = new HttpHost(
  InetAddress.getByAddress(new byte[] {2,2,2,2}), 443, "https");
HttpGet httpGet = new HttpGet("https://www.google.com/");
httpClient.execute(target, httpGet);

Oleg



---------------------------------------------------------------------
To unsubscribe, e-mail: httpclient-users-unsubscribe@hc.apache.org
For additional commands, e-mail: httpclient-users-help@hc.apache.org


Mime
View raw message