Amp\Artax\HttpTunneler::tunnel PHP Method

tunnel() public method

Establish an HTTP tunnel to the specified authority over this socket
public tunnel ( resource $socket, string $authority ) : Amp\Promise
$socket resource
$authority string
return Amp\Promise
    public function tunnel($socket, $authority)
    {
        $struct = new HttpTunnelStruct();
        $struct->promisor = new Deferred();
        $struct->socket = $socket;
        $struct->writeBuffer = "CONNECT {$authority} HTTP/1.1\r\n\r\n";
        $this->doWrite($struct);
        return $struct->promisor->promise();
    }