protected function waitForReadyRead($time = 0)
    {
        if (!$this->isConnected() || $this->config["blocking"]) {
            return;
        }

        do {
            $read = array($this->stream);
            $null = null;

            if ($time) {
                Signal::getInstance()->emit(
                    strtolower($this->getAdapterType()) . "WaitTimeout",
                    $time,
                    $this->getAdapter()
                );
            }

            $time = $time + $this->config["timeout"];
        } while (@stream_select($read, $null, $null, $this->config["timeout"]) == 0);
    }