public static Task <HttpRequestMessage> ReadAsHttpRequestMessageAsync(this HttpContent content, string uriScheme,
                                                                              int bufferSize, int maxHeaderSize, CancellationToken cancellationToken)
        {
            if (content == null)
            {
                throw Error.ArgumentNull("content");
            }

            if (uriScheme == null)
            {
                throw Error.ArgumentNull("uriScheme");
            }

            if (!Uri.CheckSchemeName(uriScheme))
            {
                throw Error.Argument("uriScheme", Properties.Resources.HttpMessageParserInvalidUriScheme, uriScheme, typeof(Uri).Name);
            }

            if (bufferSize < MinBufferSize)
            {
                throw Error.ArgumentMustBeGreaterThanOrEqualTo("bufferSize", bufferSize, MinBufferSize);
            }

            if (maxHeaderSize < InternetMessageFormatHeaderParser.MinHeaderSize)
            {
                throw Error.ArgumentMustBeGreaterThanOrEqualTo("maxHeaderSize", maxHeaderSize, InternetMessageFormatHeaderParser.MinHeaderSize);
            }

            HttpMessageContent.ValidateHttpMessageContent(content, true, true);

            return(content.ReadAsHttpRequestMessageAsyncCore(uriScheme, bufferSize, maxHeaderSize, cancellationToken));
        }