public function close()
    {
        if($this->connection !== null)
        {
            if ($this->writeEvent) {
                $this->loop->removeWriteStream($this->connection);
            }
            $this->loop->removeReadStream($this->connection);
            fclose($this->connection);
            $this->emit('close', array($this));
        }
        $this->connection = null;
    }