/**
* Close connection and discard not sent data.
*/
public function close()
{
if ($this->closed) {
return;
}
$this->emit('end', [$this]);
$this->loop->removeStream($this->fd);
$this->buffer->flushListeners();
$this->flushListeners();
unset($this->socket);
$this->closed = true;
}