The http server side.
Inheritance: IDisposable
        /// <summary>
        /// Initializes a new instance of the PccrtpServer class with specified logger instance.
        /// </summary>
        /// <param name="listenPort">Indicates the PCCRTP server's listen port.</param>
        /// <param name="addressType">Indicates the PCCRTP server's address type is Ipv4 or Ipv6.</param>
        /// <param name="logger">An instance of ILogPrinter.</param>
        public PccrtpServer(int listenPort, IPAddressType addressType, ILogPrinter logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger", "The input parameter \"logger\" is null.");
            }

            this.logger = logger;
            this.httpServerTransport = new HttpServerTransport(
                TransferProtocol.HTTP,
                listenPort,
                addressType,
                null,
                this.logger);

            this.httpServerTransport.HttpRequestEventHandle += new EventHandler<HttpRequestEventArg>(this.OnHttpRequestMessageReceived);
        }
        /// <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.httpServerTransport != null)
                    {
                        this.httpServerTransport.Dispose();
                        this.httpServerTransport = null;
                    }

                    if (this.httpRequest != null)
                    {
                        this.httpRequest = null;
                    }

                    if (this.logger != null)
                    {
                        this.logger = null;
                    }
                }
            }

            // Note disposing has been done.
            this.disposed = true;
        }
        /// <summary>
        /// Initializes a new instance of the PCHCServer class 
        /// with the specified osted Cache Mode Listen Port and IPAddress type.
        /// </summary>
        /// <param name="transferProtocol">The transport type will be used</param>
        /// <param name="hostedCacheModeListenPort">
        /// The specified BranchCache service's listen port in hosted cache mode.
        /// </param>
        /// <param name="ipaddressType">The IP address type.</param>
        /// <param name="logger">The logger.</param>
        public PCHCServer(
            TransferProtocol transferProtocol,
            int hostedCacheModeListenPort,
            IPAddressType ipaddressType,
            ILogPrinter logger)
        {
            if (logger == null)
            {
                throw new ArgumentNullException("logger", "The input parameter \"logger\" is null.");
            }

            this.logger = logger;

            this.httpServerTransport = new HttpServerTransport(
                transferProtocol,
                hostedCacheModeListenPort,
                ipaddressType,
                PCHCRESOURCE,
                logger);

            this.httpServerTransport.HttpRequestEventHandle
                += new EventHandler<HttpRequestEventArg>(this.ReceiveHttpRequest);

            this.logger.AddDebug(@"Register the delegate EventHandle with generic parameter HttpRequestEverntArg
                and the handle method is ReceiveHttpRequest.");
        }
        /// <summary>
        /// Initializes a new instance of the PCHCServer class 
        /// with the specified osted Cache Mode Listen Port and IPAddress type.
        /// </summary>
        /// <param name="transferProtocol">The transport type will be used</param>
        /// <param name="hostedCacheModeListenPort">
        /// The specified BranchCache service's listen port in hosted cache mode.
        /// </param>
        /// <param name="ipaddressType">The IP address type.</param>
        public PCHCServer(TransferProtocol transferProtocol, int hostedCacheModeListenPort, IPAddressType ipaddressType)
        {
            this.httpServerTransport = new HttpServerTransport(
                transferProtocol,
                hostedCacheModeListenPort,
                ipaddressType,
                PCHCRESOURCE);

            this.httpServerTransport.HttpRequestEventHandle += new EventHandler<HttpRequestEventArg>(this.ReceiveHttpRequest);
        }
        /// <summary>
        /// Initializes a new instance of the PccrtpServer class with specified logger instance.
        /// </summary>
        /// <param name="listenPort">Indicates the PCCRTP server's listen port.</param>
        /// <param name="addressType">Indicates the PCCRTP server's address type is Ipv4 or Ipv6.</param>
        public PccrtpServer(int listenPort, IPAddressType addressType)
        {
            this.httpServerTransport = new HttpServerTransport(
                TransferProtocol.HTTP,
                listenPort,
                addressType,
                null);

            this.httpServerTransport.HttpRequestEventHandle += new EventHandler<HttpRequestEventArg>(this.OnHttpRequestMessageReceived);
        }
        /// <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.httpServerTransport != null)
                    {
                        this.httpServerTransport.Dispose();
                        this.httpServerTransport = null;
                    }

                    if (this.httpListenerContext != null)
                    {
                        this.httpListenerContext = null;
                    }

                    if (this.logger != null)
                    {
                        this.logger = null;
                    }
                }
            }

            // Call the appropriate methods to clean up unmanaged resources.
            // If disposing is false, only the following code is executed:
            this.disposed = true;
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="PccrrServer"/> class.
        /// </summary>
        /// <param name="serverPort">The server port.</param>
        /// <param name="pccrrPath">The pccrr path.</param>
        /// <param name="addressType">The IP address type.</param>
        public PccrrServer(
            int serverPort,
            string pccrrPath,
            IPAddressType addressType)
        {
            if (pccrrPath == null)
            {
                throw new ArgumentNullException("pccrrPath");
            }

            this.serverPort = serverPort;
            this.url = pccrrPath;
            this.addressType = addressType;

            this.httpServerTransport = new HttpServerTransport(TransferProtocol.HTTP, serverPort, addressType, pccrrPath);
            this.httpServerTransport.HttpRequestEventHandle += new EventHandler<HttpRequestEventArg>(this.HttpServerTransport_ReceiveFrom);
        }
        /// <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.httpServerTransport != null)
                    {
                        this.httpServerTransport.Dispose();
                        this.httpServerTransport = null;
                    }
                }

                this.disposed = true;
            }
        }