public Response Process(Request req) { s_diagnosticListener.HostingRequest(req); var response = req.CreateResponse(); try { if (!"tars_ping".Equals(req.FuncName, StringComparison.OrdinalIgnoreCase)) { serverInvoker.Invoke(req, response); } } catch (TarsException ex) { response.ResultStatusCode = ex.RpcStatusCode; response.ResultDesc = ex.Message; s_diagnosticListener.HostingException(req, response, ex); } catch (Exception ex) { response.ResultStatusCode = RpcStatusCode.ServerUnknownErr; response.ResultDesc = ex.Message; s_diagnosticListener.HostingException(req, response, ex); } finally { s_diagnosticListener.HostingResponse(req, response); } return(response); }
public void WhenCanHostingResponseShouldSameRequest() { var listener = new DiagnosticListener(D.DiagnosticListenerName); var sut = new TestDiagnostic(); listener.SubscribeWithAdapter(sut); var result = new Request(); var response = new Response(); listener.HostingResponse(result, response); Assert.Same(result, sut.Request); Assert.Same(response, sut.Response); }