/// <summary>
        /// Sends the specified request and waits for a response using the specified connection.
        /// </summary>
        /// <param name="connection">The connection to use for communication</param>
        /// <param name="request">The request to send</param>
        /// <param name="exception">Any exception that is throw or encountered during the request/response session with the server</param>
        /// <returns></returns>
        public static HttpResponse GetResponse(
            HttpConnection connection,
            HttpRequest request,
            out Exception exception,
            EventHandler <HttpMessageProgressEventArgs> onSendProgress,
            EventHandler <HttpMessageProgressEventArgs> onRecvProgress,
            object stateObject)
        {
            #region Params Validation

            if (connection == null)
            {
                throw new ArgumentNullException("connection");
            }

            if (request == null)
            {
                throw new ArgumentNullException("request");
            }

            exception = null;

            #endregion

            // use the connection to get a response
            HttpResponse response = connection.GetResponse(request, onSendProgress, onRecvProgress, stateObject);

            exception = connection.GetLastException();

            // if there is no response, then obviously something went wrong, retrieve the last exception from the connection
            if (response == null)
            {
                if (exception != null)
                {
                    if (exception.GetType() == typeof(ThreadAbortException))
                    {
                        throw exception;
                    }
                }
            }

            // return the response
            return(response);
        }
		/// <summary>
		/// Sends the specified request and waits for a response using the specified connection.
		/// </summary>
		/// <param name="connection">The connection to use for communication</param>
		/// <param name="request">The request to send</param>
		/// <param name="exception">Any exception that is throw or encountered during the request/response session with the server</param>
		/// <returns></returns>
		public static HttpResponse GetResponse(
			HttpConnection connection, 
			HttpRequest request, 
			out Exception exception,
			EventHandler<HttpMessageProgressEventArgs> onSendProgress,
			EventHandler<HttpMessageProgressEventArgs> onRecvProgress,
			object stateObject)
		{
			#region Params Validation

			if (connection == null)
				throw new ArgumentNullException("connection");

			if (request == null)
				throw new ArgumentNullException("request");

			exception = null;

			#endregion

			// use the connection to get a response
			HttpResponse response = connection.GetResponse(request, onSendProgress, onRecvProgress, stateObject);

            exception = connection.GetLastException();

			// if there is no response, then obviously something went wrong, retrieve the last exception from the connection
			if (response == null)
			{
				if (exception != null)
					if (exception.GetType() == typeof(ThreadAbortException))
						throw exception;
			}
			
			// return the response
			return response;
		}