Can I use HTTPS proxies in HTMLunit?

I am new to HTMLunit and trying to install the HTTPS proxy for HTMLunit. I tried to use https: // just before the HOST IP, but I have an Exception.

Can anyone help me solve this problem?


Update: my code:

 WebClient webClient = new  WebClient(BrowserVersion.FIREFOX_3_6,"https://199.127.100.13", 11888);

Update 2: I asked the developers, said that this is a mistake in the framework. They will fix it.

+5
source share
1 answer

You cannot place http: // or https: // behind the IP address of the proxy server.

If your HTTP proxy supports https, then htmlunit will automatically use it. Below is an example of using a proxy server with htmlunit

For HTTP Proxy

                ProxyConfig pc = new ProxyConfig();
                pc.setSocksProxy(false); //Set to false if it is a http server
                pc.setProxyHost("192.168.1.200"); //your proxy IP
                pc.setProxyPort(proxyPort);
                webClient.getOptions().setProxyConfig(pc);

, , - socks, setSocksProxy true.

+1

All Articles