protected function setProtocol($version)
    {
        if (! is_string($version)) {
            throw new InvalidArgumentException(sprintf(
                'The HTTP protocol version must be a string, received "%s".',
                is_object($version) ? get_class($version) : gettype($version)
            ));
        }
        $version = trim($version);
        if (! $version) {
            throw new InvalidArgumentException(
                'The version of HTTP protocol can not be empty.'
            );
        }
        if (version_compare($version, '1.0', '<')) {
            throw new DomainException(sprintf(
                'The protocol "%s" is already not supported.',
                $version
            ));
        }
        if (version_compare($version, '2.0', '>=')) {
            throw new DomainException(sprintf(
                'The protocol "%s" is not yet supported.',
                $version
            ));
        }
        $this->protocol = $version;

        return $this;
    }