@Override
    public void connectFailed(final URI uri, final SocketAddress sa, final IOException ioe) {
        final ProxySelector selector = currentSelector.get();
        if (selector != null) {
            selector.connectFailed(uri, sa, ioe);
            currentSelector.remove();
            if (LOG.isDebugEnabled()) {
                LOG.debug("Removed the current ProxySelector for URI {}: {}", uri, selector);
            }
        }
    }
Notifies the active {@link ProxySelector} of a connection failure. This method
retrieves the current {@link ProxySelector} from the {@link ThreadLocal} variable and
delegates the handling of the connection failure to the underlying
ProxySelector's connectFailed() method. After handling the connection
failure, the current ProxySelector is removed from the {@link ThreadLocal} variable.

@param uri the {@link URI} that failed to connect.
@param sa  the {@link SocketAddress} of the proxy that failed to connect.
@param ioe the {@link IOException} that resulted from the failed connection.
httpclient5/src/main/java/org/apache/hc/client5/http/impl/routing/DistributedProxySelector.java