

def connect(self):
    'Connect to a host on a given (SSL) port.'
    sock = socket_create_connection((self.host, self.port), self.timeout, self.source_address)
    if self._tunnel_host:
        self.sock = sock
        self._tunnel()
    server_hostname = (self.host if ssl.HAS_SNI else None)
    self.sock = self._context.wrap_socket(sock, server_hostname=server_hostname)
    try:
        if self._check_hostname:
            ssl.match_hostname(self.sock.getpeercert(), self.host)
    except Exception:
        self.sock.shutdown(socket.SHUT_RDWR)
        self.sock.close()
        raise

dataset/ETHPy150Open OpenCobolIDE/OpenCobolIDE/open_cobol_ide/extlibs/future/backports/http/client.py HTTPSConnection.connect/original