public static function createProtocolMessage(Message $msg)
    {
        $version = $msg->shift();
        if (!self::hasProtocolVersion(($version))) {
            throw new UnknownProtocolVersionException();
        }

        $type = $msg->shift();
        $class = self::getClassByType($type);

        return $class::fromMessage($msg);
    }