Beispiel #1
0
        public async Task <Response> SendAsync(Request req)
        {
            s_diagnosticListener.ClientRequest(req);
            Response response = null;

            try
            {
                req.RequestId = callBack.NewCallBackId();
                await SendRequestAsync(req);

                if (req.IsOneway)
                {
                    response = req.CreateResponse();
                }
                else
                {
                    response = await callBack.NewCallBackTask(req.RequestId, req.Timeout, req.ServantName, req.FuncName);

                    response.CheckResultStatus();
                    response.Codec = req.Codec;
                }

                return(response);
            }
            catch (Exception ex)
            {
                s_diagnosticListener.ClientException(req, response, ex);
                throw;
            }
            finally
            {
                s_diagnosticListener.ClientResponse(req, response);
            }
        }
Beispiel #2
0
        public void WhenCanClientResponseShouldSameRequest()
        {
            var listener = new DiagnosticListener(D.DiagnosticListenerName);
            var sut      = new TestDiagnostic();

            listener.SubscribeWithAdapter(sut);
            var result   = new Request();
            var response = new Response();

            listener.ClientResponse(result, response);
            Assert.Same(result, sut.Request);
            Assert.Same(response, sut.Response);
        }