/** {@inheritDoc} */ @Override public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) { if (uri == null || sa == null || ioe == null) { throw new IllegalArgumentException("Arguments can not be null."); } final ProxyDecorator p = proxies.get(sa); if (p != null) { if (p.failed() >= 3) { proxies.remove(sa); } } else { if (defaultSelector != null) { defaultSelector.connectFailed(uri, sa, ioe); } } }
/** {@inheritDoc} */ @Override public List<Proxy> select(final URI uri) { if (uri == null) { throw new IllegalArgumentException("Arguments can not be null."); } final String protocol = uri.getScheme(); if ("http".equalsIgnoreCase(protocol) || "https".equalsIgnoreCase(protocol)) { final ArrayList<Proxy> proxyList = new ArrayList<>(); for (final ProxyDecorator p : proxies.values()) { proxyList.add(p.getProxy()); } return proxyList; } if (defaultSelector != null) { return defaultSelector.select(uri); } else { final ArrayList<Proxy> proxyList = new ArrayList<>(); proxyList.add(Proxy.NO_PROXY); return proxyList; } }