/// <summary>
        /// Given a request - forward it
        /// </summary>
        /// <param name="incomingRequest">request to proxy</param>
        /// <returns>response back to requester</returns>
        protected override Response ForwardRequest(Request incomingRequest)
        {
            // check the invariant: the request must have the proxy-uri set
            if (!incomingRequest.HasOption(OptionType.ProxyUri)) {
                _Log.Warn("Proxy-uri option not set.");
                return new Response(StatusCode.BadOption);
            }

            // create a new request to forward to the requested coap server
            Request outgoingRequest;

            try {
                outgoingRequest = CoapTranslator.GetRequest(incomingRequest);

                outgoingRequest.Send();
            }
            catch (TranslationException ex) {
                _Log.Warn(m => m("Proxy-uri option malformed: {0}", ex.Message));
                return new Response(StatusCode.BadOption);
            }
            catch (System.IO.IOException ex) {
                _Log.Warn(m => m("Failed to execute request: {0}", ex.Message));
                return new Response(StatusCode.InternalServerError);
            }

            // receive the response
            Response receivedResponse;

            try {
                // M00BUG - Should time out on this and we don't right now.
                receivedResponse = outgoingRequest.WaitForResponse();
            }
            catch (System.Threading.ThreadInterruptedException ex) {
                _Log.Warn(m => m("Receiving of response interrupted: {0}", ex.Message));
                return new Response(StatusCode.InternalServerError);
            }

            if (receivedResponse == null) {
                return new Response(StatusCode.GatewayTimeout);
            }

            // create the real response for the original request
            Response outgoingResponse = CoapTranslator.GetResponse(receivedResponse);
            return outgoingResponse;
        }
        protected override Response ForwardRequest(Request incomingRequest)
        {
            // check the invariant: the request must have the proxy-uri set
            if (!incomingRequest.HasOption(OptionType.ProxyUri))
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Proxy-uri option not set.");
                }
                return(new Response(Code.BadOption));
            }

            // remove the fake uri-path
            // FIXME: HACK
            incomingRequest.RemoveOptions(OptionType.UriPath);

            // create a new request to forward to the requested coap server
            Request outgoingRequest = null;

            try
            {
                outgoingRequest = CoapTranslator.GetRequest(incomingRequest);
                outgoingRequest.ResponseQueueEnabled = true;
                outgoingRequest.Token = TokenManager.Instance.AcquireToken();

                outgoingRequest.Execute();
                incomingRequest.Accept();
            }
            catch (TranslationException ex)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Proxy-uri option malformed: " + ex.Message);
                }
                return(new Response(Code.BadOption));
            }
            catch (System.IO.IOException ex)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Failed to execute request: " + ex.Message);
                }
                return(new Response(Code.InternalServerError));
            }

            // receive the response
            Response receivedResponse;

            try
            {
                receivedResponse = outgoingRequest.ReceiveResponse();
            }
            catch (System.Threading.ThreadInterruptedException ex)
            {
                if (log.IsWarnEnabled)
                {
                    log.Warn("Receiving of response interrupted: " + ex.Message);
                }
                return(new Response(Code.InternalServerError));
            }

            if (receivedResponse == null)
            {
                return(new Response(Code.GatewayTimeout));
            }
            else
            {
                // create the real response for the original request
                Response outgoingResponse = CoapTranslator.GetResponse(receivedResponse);
                return(outgoingResponse);
            }
        }