HttpClientTransport class provides transport layer support.
Inheritance: IDisposable
        /// <summary>
        /// Initializes a new instance of the PCHCClient class 
        /// With the specified http transport type, server name, linsten port number and resource.
        /// </summary>
        /// <param name="httpTransportType">Http transport type.</param>
        /// <param name="serverName">The server name.</param>
        /// <param name="port">The listening port.</param>
        /// <param name="resource">The resource.</param>
        /// <param name="domainName">The domain name.</param>
        /// <param name="userName">The user name.</param>
        /// <param name="userPassword">The password.</param>
        public PCHCClient(TransferProtocol httpTransportType, string serverName, int port, string resource, string domainName, string userName, string userPassword)
        {
            if (httpTransportType != TransferProtocol.HTTP && httpTransportType != TransferProtocol.HTTPS)
            {
                throw new ArgumentException(
                    "httpTransportType contains invalid not supported transport type", "httpTransportType");
            }

            this.httpClientTransport = new HttpClientTransport(httpTransportType, serverName, port, resource, domainName, userName, userPassword);
        }
        protected bool SetupHttpsConnection()
        {
            sutControlAdapter.ClearCache(testConfig.HostedCacheServerComputerFQDNOrNetBiosName);

            int timeout = 20000;
            byte[] content = TestUtility.GenerateRandomArray(10);

            HttpClientTransport testClient = new HttpClientTransport(
                TransferProtocol.HTTPS,
                testConfig.HostedCacheServerComputerName,
                testConfig.HostedCacheServerHTTPSListenPort,
                PchcConsts.HttpsUrl,
                testConfig.DomainName,
                testConfig.UserName,
                testConfig.UserPassword);
            try
            {
                testClient.Send(HttpVersion.Version10, null, content, HttpMethod.POST, timeout);
            }
            catch (Exception)
            {
                return false;
            }
            finally
            {
                testClient.Dispose();
            }

            return true;
        }
        /// <summary>
        /// Initializes a new instance of the PCHCClient class 
        /// With the specified http transport type, server name, linsten port number and resource.
        /// </summary>
        /// <param name="httpTransportType">Http transport type.</param>
        /// <param name="serverName">The server name.</param>
        /// <param name="port">The listening port.</param>
        /// <param name="resource">The resource.</param>
        /// <param name="logger">The logger.</param>
        public PCHCClient(TransferProtocol httpTransportType, string serverName, int port, string resource, ILogPrinter logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger", "The input parameter \"logger\" is null.");
            }

            this.logger = logger;

            if (httpTransportType != TransferProtocol.HTTP && httpTransportType != TransferProtocol.HTTPS)
            {
                throw new ArgumentException(
                    "httpTransportType contains invalid not supported transport type", "httpTransportType");
            }

            this.httpClientTransport = new HttpClientTransport(httpTransportType, serverName, port, resource, logger);
        }
        /// <summary>
        /// Dispose(bool disposing) executes in two distinct scenarios.
        /// If disposing equals true, the method has been called directly
        /// or indirectly by a user's code. Managed and unmanaged resources
        /// can be disposed.
        /// If disposing equals false, the method has been called by the 
        /// runtime from inside the finalizer and you should not reference 
        /// other objects. Only unmanaged resources can be disposed
        /// </summary>
        /// <param name="disposing">Specify which scenario is used.</param>
        private void Dispose(bool disposing)
        {
            // Check to see if Dispose has already been called.
            if (!this.disposed)
            {
                // If disposing equals true, dispose all managed
                // and unmanaged resources.
                if (disposing)
                {
                    if (this.httpClientTransport != null)
                    {
                        this.httpClientTransport.Dispose();
                        this.httpClientTransport = null;
                    }
                }
            }

            // Note disposing has been done.
            this.disposed = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PccrrClient"/> class.
        /// </summary>
        /// <param name="server">The server name.</param>
        /// <param name="serverPort">The serverPort.</param>
        /// <param name="pccrrPath">The HTTP request uri.</param>
        /// <param name="method">The HTTP request method.</param>
        public PccrrClient(
            string server,
            int serverPort,
            string pccrrPath,
            HttpMethod method)
        {
            if (server == null)
            {
                throw new ArgumentNullException("server");
            }

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

            this.serverName = server;
            this.serverPort = serverPort;
            this.url = pccrrPath;
            this.method = method;

            this.httpClientTransport = new HttpClientTransport(TransferProtocol.HTTP, server, serverPort, pccrrPath);
        }
        /// <summary>
        /// Release resources.
        /// </summary>
        /// <param name="disposing">If disposing equals true, Managed and unmanaged resources are disposed.
        /// if false, Only unmanaged resources can be disposed.</param>
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                if (disposing)
                {
                    if (this.httpClientTransport != null)
                    {
                        this.httpClientTransport.Dispose();
                        this.httpClientTransport = null;
                    }
                }

                this.disposed = true;
            }
        }
        /// <summary>
        /// Release resources. 
        /// </summary>
        /// <param name = "disposing">
        /// If disposing equals true, managed and unmanaged resources are disposed. 
        /// If false, only unmanaged resources can be disposed. 
        /// </param>
        protected virtual void Dispose(bool disposing)
        {
            if (!this.disposed)
            {
                // If disposing equals true, dispose all managed and unmanaged resources.
                if (disposing)
                {
                    // Free managed resources & other reference types:
                    if (this.httpClientTransport != null)
                    {
                        this.httpClientTransport.Dispose();
                        this.httpClientTransport = null;
                    }
                }

                // Call the appropriate methods to clean up unmanaged resources.
                // If disposing is false, only the following code is executed:
                this.disposed = true;
            }
        }
        /// <summary>
        /// Send HTTP request for partial content and receive HTTP response from the server.
        /// </summary>
        /// <param name="httpVersion">The HTTP version.</param>
        /// <param name="request">The PCCRTP request.</param>
        /// <param name="timeOut">The number of milliseconds to wait before the request times out</param>
        /// <param name="rangeFrom">The start position at which to the requested data.</param>
        /// <param name="rangeTo">The end position at which to the requested data.</param>
        /// <returns>Returns the PCCRTP response.</returns>
        public PccrtpResponse SendHttpRequest(
            HttpVersionType httpVersion,
            PccrtpRequest request,
            int timeOut,
            int rangeFrom,
            int rangeTo)
        {
            byte[] payloadBuffer = null;

            if (this.logger != null)
            {
                this.httpClientTransport = new HttpClientTransport(
                    TransferProtocol.HTTP,
                    request.ServerAddress,
                    request.Port,
                    request.RequestFileName,
                    this.logger);
            }
            else
            {
                this.httpClientTransport = new HttpClientTransport(
                    TransferProtocol.HTTP,
                    request.ServerAddress,
                    request.Port,
                    request.RequestFileName);
            }

            if (HttpVersionType.HttpVersion10 == (HttpVersionType)httpVersion)
            {
                this.httpClientTransport.Send(
                    HttpVersion.Version10,
                    request.HttpHeader,
                    null,
                    HttpMethod.GET,
                    timeOut,
                    rangeFrom,
                    rangeTo);
            }
            else
            {
                // The default version of HTTP to use for the request is HTTP 1.1.
                this.httpClientTransport.Send(
                    HttpVersion.Version11,
                    request.HttpHeader,
                    null,
                    HttpMethod.GET,
                    timeOut,
                    rangeFrom,
                    rangeTo);
            }

            this.httpWebResponse = this.httpClientTransport.Receive(ref payloadBuffer);

            this.pccrtpResponse.DecodeHttpHeader(this.httpWebResponse);
            this.pccrtpResponse.PayloadData = payloadBuffer;
            this.pccrtpResponse.HttpResponse = this.httpWebResponse;

            this.pccrtpResponse.HttpResponse = this.httpWebResponse;

            return this.pccrtpResponse;
        }