/// <summary>
        /// Append the components of an HTTP response.
        /// </summary>
        /// <param name="text">The StringBuilder.</param>
        /// <param name="statusCode">The response status code.</param>
        /// <param name="reasonPhrase">The response reason phrase.</param>
        /// <param name="version">The response HTTP version.</param>
        /// <param name="headers">The response headers.</param>
        /// <param name="contentHeaders">The response content headers.</param>
        /// <param name="content">The response content.</param>
        private static void AppendHttpResponse(
            this StringBuilder text,
            HttpStatusCode statusCode,
            string reasonPhrase,
            Version version,
            IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers,
            IEnumerable<KeyValuePair<string, IEnumerable<string>>> contentHeaders,
            string content)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }
            else if (version == null)
            {
                throw new ArgumentNullException("version");
            }

            text.AppendLine();
            text.AppendLine("RESPONSE:");
            text.AppendFormat(
                "HTTP/{0}  {1} ({2}):  {3}",
                version,
                statusCode,
                (int)statusCode,
                reasonPhrase);
            text.AppendLine();

            text.AppendHttpHeaders(headers);
            text.AppendHttpHeaders(contentHeaders);
            if (content != null)
            {
                text.AppendLine();
                text.AppendLine("RESPONSE BODY:");
                text.AppendLine(content);
            }
        }
        /// <summary>
        /// Append the components of an HTTP request.
        /// </summary>
        /// <param name="text">The StringBuilder.</param>
        /// <param name="method">The request method.</param>
        /// <param name="requestUri">The request URI.</param>
        /// <param name="version">The request HTTP version.</param>
        /// <param name="headers">The request headers.</param>
        /// <param name="contentHeaders">The request content headers.</param>
        /// <param name="properties">The request properties.</param>
        /// <param name="content">The request content.</param>
        private static void AppendHttpRequest(
            this StringBuilder text,
            HttpMethod method,
            Uri requestUri,
            Version version,
            IEnumerable<KeyValuePair<string, IEnumerable<string>>> headers,
            IEnumerable<KeyValuePair<string, IEnumerable<string>>> contentHeaders,
            IDictionary<string, object> properties,
            string content)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }
            else if (requestUri == null)
            {
                throw new ArgumentNullException("requestUri");
            }
            else if (version == null)
            {
                throw new ArgumentNullException("version");
            }

            text.AppendLine("REQUEST:");
            text.AppendFormat(
                "{0} {1} HTTP/{2}",
                method.ToString().ToUpper(),
                requestUri.ToString(),
                version.ToString());
            text.AppendLine();

            text.AppendHttpHeaders(headers);
            text.AppendHttpHeaders(contentHeaders);

            if (properties != null)
            {
                foreach (KeyValuePair<string, object> property in properties)
                {
                    text.AppendFormat("// Property {0}: {1}", property.Key, property.Value);
                    text.AppendLine();
                }
            }

            if (content != null)
            {
                text.AppendLine();
                text.AppendLine("REQUEST BODY:");
                text.AppendLine(content);
            }
        }