I need to read the proxy information from the phone, and if the phone is under the proxy server, I need to install this proxy server on my spring restTemplate object. I tried the following code with no luck, could someone tell me what I'm doing wrong.
String proxyHost = android.net.Proxy.getHost(activity .getApplicationContext()); SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, 8080)); requestFactory.setProxy(proxy); RestTemplate rest = new RestTemplate(requestFactory);
Thanks for any help
source share