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 Daniil Chipenko <su...@gmail.com> on 2008/02/19 17:17:44 UTC

Is it possible to set ProxyHost to null?

Hello,

Is it possible somehow to disable using proxy in HTTPClient, if it already
has set before? Maybe assign null, which is not allowed by superclass?

Here is sample:

HttpClient client = new HttpClient();
        try {
            HostConfiguration config = client.getHostConfiguration();
            config.setProxy('proxy.myorg.net',  3128);
            client.setHostConfiguration(config);

            // do something

            config.setProxy(null,  -1);                          \\  <-----
Exception was raised in this line
            client.setHostConfiguration(config);
        } finally {
       }



resulted:
null
-1
Exception in thread "main" java.lang.IllegalArgumentException: Host name may
not be null