@Override
    public SSLSocket upgrade(final Socket socket,
                             final String target,
                             final int port,
                             final Object attachment,
                             final HttpContext context) throws IOException {
        final SSLSocket upgradedSocket = (SSLSocket) sslContext.getSocketFactory().createSocket(
                socket,
                target,
                port,
                false);
        try {
            executeHandshake(upgradedSocket, target, attachment);
            return upgradedSocket;
        } catch (IOException | RuntimeException ex) {
            Closer.closeQuietly(upgradedSocket);
            throw ex;
        }
    }
@deprecated use {@link #upgrade(TransportSecurityLayer, NamedEndpoint, Object, Timeout, FutureCallback)}
httpclient5/src/main/java/org/apache/hc/client5/http/ssl/AbstractClientTlsStrategy.java