public static function isValidProtocolVersion($version)
    {
        if (!is_string($version) || empty($version)) {
            return false;
        }

        return (bool) preg_match('#^(1\.[01]|2)$#', $version);
    }