public function getGroups(): Generator
    {
        $command = new Command('LIST ACTIVE');
        $response = yield from $this->sendCommand($command);

        $data = yield from $this->encoder->readData($this->stream);

        if (preg_match_all('/([A-z\._-]+)\s+(\d+)\s+(\d+)\s+(\w)/', $data, $matches, PREG_SET_ORDER) === false) {
            throw new FormatException('Invalid groups format');
        }

        return array_map(function ($matches) {
            if ($matches[4] === 'y') {
                $status = Group::POSTING_PERMITTED;
            } elseif ($matches[4] === 'n') {
                $status = Group::POSTING_NOT_PERMITTED;
            } elseif ($matches[4] === 'm') {
                $status = Group::POSTING_FORWARDED;
            } else {
                $status = Group::STATUS_UNKNOWN;
            }

            $high = (int)$matches[2];
            $low = (int)$matches[3];
            return new Group($matches[1], $high - $low, $low, $high, $status);
        }, $matches);
    }