@Override
    public Proxy find(final String target) {
        for(java.net.Proxy proxy : selector.select(URI.create(target))) {
            switch(proxy.type()) {
                case DIRECT: {
                    return Proxy.DIRECT;
                }
                case HTTP: {
                    if(proxy.address() instanceof InetSocketAddress) {
                        final InetSocketAddress address = (InetSocketAddress) proxy.address();
                        return new Proxy(Proxy.Type.HTTP, address.getHostName(), address.getPort());
                    }
                }
                case SOCKS: {
                    if(proxy.address() instanceof InetSocketAddress) {
                        final InetSocketAddress address = (InetSocketAddress) proxy.address();
                        return new Proxy(Proxy.Type.SOCKS, address.getHostName(), address.getPort());
                    }
                }
            }
        }
        return Proxy.DIRECT;
    }
@Test
    public void testExcludedLocalHost() {
        final DefaultProxyFinder proxy = new DefaultProxyFinder();
        assertEquals(Proxy.Type.DIRECT, proxy.find("http://cyberduck.local").getType());
        assertEquals(Proxy.Type.DIRECT, proxy.find("sftp://cyberduck.local").getType());
    }