@Override
    public Socket connectSocket(
            final Socket socket,
            final HttpHost host,
            final InetSocketAddress remoteAddress,
            final InetSocketAddress localAddress,
            final Timeout connectTimeout,
            final Object attachment,
            final HttpContext context) throws IOException {
        Args.notNull(host, "HTTP host");
        Args.notNull(remoteAddress, "Remote address");
        final Socket sock = socket != null ? socket : createSocket(context);
        if (localAddress != null) {
            sock.bind(localAddress);
        }
        try {
            connectSocket(sock, remoteAddress, connectTimeout, context);
        } catch (final IOException ex) {
            Closer.closeQuietly(sock);
            throw ex;
        }
        // Setup SSL layering if necessary
        if (sock instanceof SSLSocket) {
            final SSLSocket sslsock = (SSLSocket) sock;
            executeHandshake(sslsock, host.getHostName(), attachment, context);
            return sock;
        }
        return createLayeredSocket(sock, host.getHostName(), remoteAddress.getPort(), attachment, context);
    }
Performs any custom initialization for a newly created SSLSocket
(before the SSL handshake happens).

The default implementation is a no-op, but could be overridden to, e.g.,
call {@link javax.net.ssl.SSLSocket#setEnabledCipherSuites(String[])}.
@throws IOException may be thrown if overridden
httpclient5/src/main/java/org/apache/hc/client5/http/ssl/SSLConnectionSocketFactory.java