0

I am trying to use proxyIP to make api calls. ProxyIP requires username and password to authenticate.I am setting those as per other threads and mentioned here

But I am getting following error

org.apache.http.client.HttpResponseException: Bad Request

Not sure what i am missing.Any help is appreciated.

Code :

    String response = Executor.newInstance()
        .auth(new HttpHost(proxyHost, proxyPort), "proxyuser", "proxypass")
        .authPreemptiveProxy(new HttpHost(proxyHost, proxyPort))
        .execute(Request.Get("http://bot.whatismyipaddress.com/")
            .viaProxy(new HttpHost(proxyHost, proxyPort))
             .setHeader("User-Agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:64.0) Gecko/20100101 "
            + "Firefox/64.0"))
        .returnContent()
        .asString(); 

HttpComponentVersion : 4.3.6

Vadim Kotov
  • 8,084
  • 8
  • 48
  • 62
Jeya Kumar
  • 1,002
  • 1
  • 13
  • 36

0 Answers0