Hello!
I use the following construction to access HTTP servers:
URL url = new URL(sUrl); Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyElement.getIP(), proxyElement.getPort())); HttpURLConnection urlConnection = (HttpURLConnection)url.openConnection(proxy);
There were questions:
- How to interrupt the connection by timeout, sometimes it happens that the proxy "hangs" without an answer?
- How can I get around specifying the exact type of proxy? Is it possible to somehow determine it before connecting?