protected function readReply(&$untagged = null)
    {
        do {
            $line = trim($this->readLine(1024));
            // store untagged response lines
            if ($line[0] == '*') {
                $untagged[] = $line;
            }
        }
        while ($line[0] == '*');

        if ($untagged) {
            $untagged = join("\n", $untagged);
        }

        return $line;
    }