@Override
    public Proxy find(final String target) {
        switch(Scheme.valueOf(URI.create(target).getScheme())) {
            case ftp:
            case ftps:
            case sftp:
                final String ftp_proxy = System.getenv("ftp_proxy");
                if(StringUtils.isNotBlank(ftp_proxy)) {
                    try {
                        final URI uri = new URI(ftp_proxy);
                        return new Proxy(Proxy.Type.SOCKS, uri.getHost(), uri.getPort());
                    }
                    catch(URISyntaxException e) {
                        log.warn(String.format("Invalid URL in ftp_proxy environment variable. %s", ftp_proxy));
                    }
                }
                break;
            case http:
                final String http_proxy = System.getenv("http_proxy");
                if(StringUtils.isNotBlank(http_proxy)) {
                    try {
                        final URI uri = new URI(http_proxy);
                        return new Proxy(Proxy.Type.HTTP, uri.getHost(), uri.getPort());
                    }
                    catch(URISyntaxException e) {
                        log.warn(String.format("Invalid URL in ftp_proxy environment variable. %s", http_proxy));
                    }
                }
                break;
            case https:
                final String https_proxy = System.getenv("https_proxy");
                if(StringUtils.isNotBlank(https_proxy)) {
                    try {
                        final URI uri = new URI(https_proxy);
                        return new Proxy(Proxy.Type.HTTP, uri.getHost(), uri.getPort());
                    }
                    catch(URISyntaxException e) {
                        log.warn(String.format("Invalid URL in ftp_proxy environment variable. %s", https_proxy));
                    }
                }
                break;
        }
        return new DefaultProxyFinder().find(target);
    }
@Test
    public void testFind() {
        final DefaultProxyFinder proxy = new DefaultProxyFinder();
        assertEquals(Proxy.Type.DIRECT, proxy.find("http://cyberduck.io").getType());
        assertEquals(Proxy.Type.DIRECT, proxy.find("sftp://cyberduck.io").getType());
        assertEquals(Proxy.Type.DIRECT, proxy.find("ftp://cyberduck.io").getType());
        assertEquals(Proxy.Type.DIRECT, proxy.find("ftps://cyberduck.io").getType());
    }