public function connect()
    {
        $connectTimeout = 1;
        $errstr = '';
        $errno = 0;
        $stream = @stream_socket_client($this->nodeUrl, $errno, $errstr, $connectTimeout);

        if (!$stream) {
            $this->log->warning('unable to connect to '.$this->nodeUrl.': '.$errstr);
            throw new ConnectException('Unable to connect to resource '.$this->nodeUrl.'. '.$errstr, $errno);
        }

        $this->log->info('connected to '.$this->nodeUrl);
        $this->stream = $stream;

        return true;
    }