You are viewing a plain text version of this content. The canonical link for it is here.
Posted to httpclient-users@hc.apache.org by 风 <30...@qq.com> on 2014/10/23 09:07:17 UTC
how to config the ip of the site?
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?
thanks very much!!
Re: how to config the ip of the site?
Posted by Oleg Kalnichevski <ol...@apache.org>.
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