public void HandleRequest(HttpContext context)
        {
            IMessage             message;
            ITransportHeaders    headers2;
            Stream               stream2;
            HttpRequest          request        = context.Request;
            HttpResponse         httpResponse   = context.Response;
            BaseTransportHeaders requestHeaders = new BaseTransportHeaders();

            requestHeaders["__RequestVerb"]         = request.HttpMethod;
            requestHeaders["__CustomErrorsEnabled"] = HttpRemotingHandler.CustomErrorsEnabled(context);
            requestHeaders.RequestUri = (string)context.Items["__requestUri"];
            NameValueCollection headers = request.Headers;

            foreach (string str in headers.AllKeys)
            {
                string str2 = headers[str];
                requestHeaders[str] = str2;
            }
            requestHeaders.IPAddress = IPAddress.Parse(request.UserHostAddress);
            Stream inputStream = request.InputStream;
            ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();

            sinkStack.Push(this, null);
            switch (this._nextSink.ProcessMessage(sinkStack, null, requestHeaders, inputStream, out message, out headers2, out stream2))
            {
            case ServerProcessing.Complete:
                this.SendResponse(httpResponse, 200, headers2, stream2);
                return;

            case ServerProcessing.OneWay:
                this.SendResponse(httpResponse, 0xca, headers2, stream2);
                break;

            case ServerProcessing.Async:
                break;

            default:
                return;
            }
        }
        } // HttpHandlerTransportSink

        public void HandleRequest(HttpContext context)
        {
            HttpRequest  httpRequest  = context.Request;
            HttpResponse httpResponse = context.Response;

            // get headers
            BaseTransportHeaders requestHeaders = new BaseTransportHeaders();

            requestHeaders["__RequestVerb"]         = httpRequest.HttpMethod;
            requestHeaders["__CustomErrorsEnabled"] = HttpRemotingHandler.CustomErrorsEnabled(context);
            requestHeaders.RequestUri = (string)context.Items["__requestUri"];

            NameValueCollection headers = httpRequest.Headers;

            String[] allKeys = headers.AllKeys;

            for (int httpKeyCount = 0; httpKeyCount < allKeys.Length; httpKeyCount++)
            {
                String headerName  = allKeys[httpKeyCount];
                String headerValue = headers[headerName];
                requestHeaders[headerName] = headerValue;
            }

            // add ip address to headers list
            requestHeaders.IPAddress = IPAddress.Parse(httpRequest.UserHostAddress);

            // get request stream
            Stream requestStream = httpRequest.InputStream;

            // process message
            ServerChannelSinkStack sinkStack = new ServerChannelSinkStack();

            sinkStack.Push(this, null);

            IMessage          responseMessage;
            ITransportHeaders responseHeaders;
            Stream            responseStream;

            ServerProcessing processing =
                _nextSink.ProcessMessage(sinkStack, null, requestHeaders, requestStream,
                                         out responseMessage,
                                         out responseHeaders, out responseStream);

            // handle response
            switch (processing)
            {
            case ServerProcessing.Complete:
            {
                // Send the response. Call completed synchronously.
                SendResponse(httpResponse, 200, responseHeaders, responseStream);
                break;
            } // case ServerProcessing.Complete

            case ServerProcessing.OneWay:
            {
                // Just send back a 202 Accepted
                SendResponse(httpResponse, 202, responseHeaders, responseStream);
                break;
            } // case ServerProcessing.OneWay

            case ServerProcessing.Async:
            {
                // Async dispatching was cut from V.1.
                //sinkStack.StoreAndDispatch(this, streamManager);
                break;
            } // case ServerProcessing.Async
            } // switch (processing)
        }     // HandleRequest