public function close()
{
if ($this->closed) {
return;
}
$this->ending = true;
$this->closed = true;
$this->stream->close();
$this->emit('close');
// reject all remaining requests in the queue
while ($this->requests) {
$request = array_shift($this->requests);
/* @var $request Request */
$request->reject(new RuntimeException('Connection closing'));
}
}