private static IPooledBuffer Serialize(IInvocationMessageReceived message, Nothing _)
 {
     using (var envelope = InvocationMessageEnvelope.Rent())
     {
         var proto = InvocationMessageReceived.Rent();
         envelope.Confirmation = proto;
         return(envelope.Serialize());
     }
 }
        private Nothing HandleIncomingConfirmation(IInvocationMessageReceived confirmation, Nothing _)
        {
            switch (_incomingStreamState)
            {
            case IncomingStreamState.Open:
            case IncomingStreamState.Completed:
                _invocationState.OnConfirmationReceived();
                break;

            case IncomingStreamState.ReceivingMessage:
                throw new InvalidOperationException(
                          $"Received unexpected message when in state {_incomingStreamState}: {confirmation}");
            }
            return(Nothing.Instance);
        }
 public T Handle(IInvocationMessageReceived header, TArgs args)
 {
     return(_confirmationHandler(header, args));
 }