Skip to content

Instantly share code, notes, and snippets.

@daleysoftware
Created December 11, 2014 22:06
Show Gist options
  • Save daleysoftware/8959b91b566ff22d74ea to your computer and use it in GitHub Desktop.
Save daleysoftware/8959b91b566ff22d74ea to your computer and use it in GitHub Desktop.
Test system proxy server settings.
import java.util.*;
import java.io.*;
import java.net.*;
public class ProxyTest
{
public static void main(String[] args) {
System.setProperty("java.net.useSystemProxies", "true");
List<Proxy> list = null;
try
{
list = ProxySelector.getDefault().select(new URI("http://google.com"));
for (Proxy p : list) {
System.out.println(p.toString());
}
}
catch (final URISyntaxException e)
{
e.printStackTrace();
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment