static async Task ProcessListenerContext(HttpListenerContext context, IAsyncRequestHandler handler)
        {
            Debug.Assert(context != null);
            Debug.Assert(handler != null);

            try
            {
                using (var response = await handler.Execute(new RequestWrapper(context.Request)) as HttpResponse)
                {
                    if (response != null)
                    {
                        context.Response.StatusCode = response.StatusCode;
                        context.Response.Headers = response.Headers;
                        response.WriteBody(context.Response.OutputStream);
                    }
                }
                context.Response.Close();
            }
            catch (HttpListenerException)
            {
                // Ignored.
            }
            catch (Exception ex)
            {
                // TODO: better exception handling
                Trace.WriteLine(ex.ToString());
            }
        }