@Override
    public List<Proxy> select(final URI uri) {
        List<Proxy> result = Collections.emptyList();
        ProxySelector selector;

        for (int i = 0; i < selectors.size(); i++) {
            selector = nextSelector();
            if (LOG.isDebugEnabled()) {
                LOG.debug("Selecting next proxy selector for URI {}: {}", uri, selector);
            }

            try {
                currentSelector.set(selector);
                result = currentSelector.get().select(uri);
                if (!result.isEmpty()) {
                    break;
                }
            } catch (final Exception e) {
                // ignore and try the next selector
                if (LOG.isDebugEnabled()) {
                    LOG.debug("Exception caught while selecting proxy for URI {}: {}", uri, e.getMessage());
                }
            } finally {
                currentSelector.remove();
            }
        }
        return result;
    }
Selects a list of proxies for the given {@link URI} by delegating to the current
{@link ProxySelector} or the next available {@link ProxySelector} in the list if the current
one returns an empty proxy list. If an {@link Exception} occurs, it will be caught
and ignored, and the next {@link ProxySelector} will be tried.

@param uri the {@link URI} to select a proxy for.
@return a list of proxies for the given {@link URI}.
httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/DistributedProxySelector.java