public void HandleOneWay(FabricTransportRequestContext requestContext, byte[] headers, byte[] requestBody)
        {
            var messageHeaders = ServiceRemotingMessageHeaders.Deserialize(this.serializer, headers);
            var context        = new FabricTransportServiceRemotingRequestContext(requestContext);

            this.messageHandler.HandleOneWay(context, messageHeaders, requestBody);
        }
        public async Task <FabricTransportReplyMessage> RequestResponseAsync(
            FabricTransportRequestContext requestContext, byte[] headers, byte[] requestBody)
        {
            // We have Cancellation Token for Remoting layer , hence timeout is not used here.
            ServiceRemotingMessageHeaders messageHeaders = null;

            try
            {
                messageHeaders = ServiceRemotingMessageHeaders.Deserialize(this.serializer, headers);
            }
            catch (Exception e)
            {
                //This can only happen if there is issue in our product code like Message Corruption or changing headers format.
                ReleaseAssert.Failfast("DeSerialization failed  for RemotingMessageHeaders with reason {0} for the headers with length {1}", e, headers.Length);
            }

            var context = new FabricTransportServiceRemotingRequestContext(requestContext);

            byte[] replybody;
            try
            {
                replybody = await this.messageHandler.RequestResponseAsync(context, messageHeaders, requestBody);

                return(new FabricTransportReplyMessage(false, replybody));
            }
            catch (Exception e)
            {
                ServiceTrace.Source.WriteInfo("FabricTransportCommunicationHandler", "Exception While dispatching {0}",
                                              e);
                var remoteExceptionInformation = RemoteExceptionInformation.FromException(e);
                replybody = remoteExceptionInformation.Data;
                return(new FabricTransportReplyMessage(true, replybody));
            }
        }