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();
}