default Socket connectSocket(
            Socket socket,
            HttpHost host,
            InetSocketAddress remoteAddress,
            InetSocketAddress localAddress,
            Timeout connectTimeout,
            Object attachment,
            HttpContext context) throws IOException {
        return connectSocket(connectTimeout, socket, host, remoteAddress, localAddress, context);
    }
Connects the socket to the target host with the given resolved remote address.

@param socket the socket to connect, as obtained from {@link #createSocket(HttpContext)}.
{@code null} indicates that a new socket should be created and connected.
@param host target host as specified by the caller (end user).
@param remoteAddress the resolved remote address to connect to.
@param localAddress the local address to bind the socket to, or {@code null} for any.
@param connectTimeout connect timeout.
@param attachment connect request attachment.
@param context the actual HTTP context.

@return  the connected socket. The returned object may be different
         from the {@code sock} argument if this factory supports
         a layered protocol.

@throws IOException if an I/O error occurs

@since 5.2
httpclient5/src/main/java/org/apache/hc/client5/http/socket/ConnectionSocketFactory.java