code: def connect_socket(self, sock: socket.socket) -> None:
          
          # Setup HTTP tunneling
          try:
              sock.connect((self._tunnel_host, self._tunnel_port))
          except socket.timeout as e:
              raise ProxyError(self.ERR_PROXY_OFFLINE.format(str(e)))
          except socket.error as e:
              raise ProxyError(self.ERR_PROXY_OFFLINE.format(str(e)))
  
          # Send a CONNECT request with the host we want to tunnel to
          if self._tunnel_basic_auth_token is None:
              sock.send(self.HTTP_CONNECT_REQ.format(self._server_host, self._server_port).encode('utf-8'))
          else:
              sock.send(self.HTTP_CONNECT_REQ_PROXY_AUTH_BASIC.format(
                  self._server_host, self._server_port, self._tunnel_basic_auth_token
              ).encode('utf-8'))
          http_response = HttpResponseParser.parse_from_socket(sock)
  
          # Check if the proxy was able to connect to the host
          if http_response.status != 200:
              raise ProxyError(self.ERR_CONNECT_REJECTED)
docs: Setup HTTP tunneling with the configured proxy.