@Test public void testSimpleExcluded() { final DefaultProxyFinder proxy = new DefaultProxyFinder(); assertEquals(Proxy.Type.DIRECT, proxy.find(new Host(new TestProtocol(), "simple")).getType()); }
@Override public Proxy find(final Host target) { if(!preferences.getBoolean("connection.proxy.enable")) { return Proxy.DIRECT; } for(java.net.Proxy proxy : selector.select(URI.create(provider.get(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; }
DefaultProxyFinder implements ProxyFinder { @Override public Proxy find(final Host target) { if(!preferences.getBoolean("connection.proxy.enable")) { return Proxy.DIRECT; } for(java.net.Proxy proxy : selector.select(URI.create(provider.get(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; } }
DefaultProxyFinder implements ProxyFinder { @Override public Proxy find(final Host target) { if(!preferences.getBoolean("connection.proxy.enable")) { return Proxy.DIRECT; } for(java.net.Proxy proxy : selector.select(URI.create(provider.get(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; }  }
DefaultProxyFinder implements ProxyFinder { @Override public Proxy find(final Host target) { if(!preferences.getBoolean("connection.proxy.enable")) { return Proxy.DIRECT; } for(java.net.Proxy proxy : selector.select(URI.create(provider.get(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; }  @Override Proxy find(final Host target); }
DefaultProxyFinder implements ProxyFinder { @Override public Proxy find(final Host target) { if(!preferences.getBoolean("connection.proxy.enable")) { return Proxy.DIRECT; } for(java.net.Proxy proxy : selector.select(URI.create(provider.get(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; }  @Override Proxy find(final Host target);  }