In the case of a "bad" ProxySelector returning proxies of types other than Proxy.Type.SOCKS to the socket impl ( java.net.SocksSocketImpl ) we should just ignore these proxies and try a direct connection, rather than throwing SocketException("Unknown proxy type : XXXX"). This is a confusing Exception and message, and a better alternative is to simply try a direct connection.
Exception in thread "main" java.net.SocketException: Unknown proxy type : HTTP
        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:395)
        at java.net.Socket.connect(Socket.java:578)
        at java.net.Socket.connect(Socket.java:527)
        at java.net.Socket.<init>(Socket.java:423)
        at java.net.Socket.<init>(Socket.java:240)
        .......
This issue has been reported on several forums and sites:
  http://www.coderanch.com/t/580126/JNLP-Web-Start/java/SocketException-Unknown-proxy-type-HTTP
  https://forums.oracle.com/forums/thread.jspa?threadID=2385257
  http://stackoverflow.com/questions/2175742/connecting-with-different-proxies-to-specific-addresses
Minimal testcase to demonstrate the problem:
-------------
public class BadProxySelector {
    public static void main(String[] args) throws Exception {
        ProxySelector oldSelector = ProxySelector.getDefault();
        ProxySelector.setDefault(new HTTPProxySelector());
        try {
            try (ServerSocket ss = new ServerSocket(0);
                 Socket s1 = new Socket(ss.getInetAddress(), ss.getLocalPort());
                 Socket s2 = ss.accept()) {
            }
        } finally {
            ProxySelector.setDefault(oldSelector);
        }
    }
    // always returns bogus HTTP proxies
    private static class HTTPProxySelector extends ProxySelector {
        @Override
        public void connectFailed(URI uri, SocketAddress sa, IOException ioe) {}
        @Override
        public List<Proxy> select(URI uri) {
            List<Proxy> proxies = new ArrayList<>();
            proxies.add(new Proxy(Proxy.Type.HTTP,
                                  new InetSocketAddress("localhost", 56789)));
            proxies.add(new Proxy(Proxy.Type.HTTP,
                                  new InetSocketAddress("localhost", 56784)));
            return proxies;
        }
    }
}
-------------