So this case internet access should go through proxy settings and all internet traffic can go through proxy configuration . Let see how proxy setting can be applied in java
URL url = new URL("GET_URL");
Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxy server", "port")); HttpURLConnection conn = (HttpURLConnection) url.openConnection(proxy);
Proxy server.URL and port needs to be changed. Once this setting is done all the request goes through proxy server. This is similar to the setting we do in browser.
0 Comments
Post a Comment