public function connect($host, $port, $secure = true)
    {
        $this->socket->setBlocking(false);

        if (!$this->socket->connect($host, $port, $secure)) {
            throw new Exception\ConnectionFailedException(
                sprintf(
                    '%s failed to %s:%d with error %s (%d).',
                    $secure ? 'Secure connection' : 'Connection',
                    $host,
                    $port,
                    $this->socket->connectionError(),
                    $this->socket->connectionErrorNo()
                )
            );
        }
    }