protected function assertValidQosLevel($level, $fromPacket = true)
    {
        if ($level < 0 || $level > 2) {
            $this->throwException(
                sprintf(
                    'Expected a quality of service level between 0 and 2 but got %d.',
                    $level
                ),
                $fromPacket
            );
        }
    }