Example #1
0
 public ValueTask <long> GetPingPongPayloadSize()
 {
     return(StubHttpMessageHandler.GetPayloadSize(channel =>
     {
         var proxy = channel.CreateGrpcService <ITestService>();
         return proxy.PingPong(_payload);
     }));
 }
Example #2
0
 public ValueTask <long> GetPingPongPayloadSize()
 {
     return(StubHttpMessageHandler.GetPayloadSize(channel =>
     {
         var proxy = _clientFactory.CreateClient <ITestService>(channel);
         return proxy.PingPong(_payload);
     }));
 }
Example #3
0
 public ValueTask <long> GetPingPongPayloadSize()
 {
     return(StubHttpMessageHandler.GetPayloadSize(channel =>
     {
         var proxy = new TestServiceNative.TestServiceNativeClient(channel);
         return proxy.PingPongAsync(_payload).ResponseAsync;
     }));
 }
Example #4
0
 public ValueTask <long> GetPingPongPayloadSize()
 {
     return(StubHttpMessageHandler.GetPayloadSize(async channel =>
     {
         var proxy = MagicOnion.Client.MagicOnionClient.Create <ITestServiceMagicOnion>(channel);
         var call = proxy.PingPong(_payload);
         await call;
     }));
 }
Example #5
0
        public static async ValueTask <long> GetPayloadSize(Func <GrpcChannel, Task> call)
        {
            using var httpHandler = new StubHttpMessageHandler();
            using var channel     = GrpcChannel.ForAddress("http://localhost", new GrpcChannelOptions { HttpHandler = httpHandler });

            try
            {
                await call(channel).ConfigureAwait(false);
            }
            catch (RpcException ex) when(ex.StatusCode == StatusCode.Cancelled)
            {
            }

            return(httpHandler.PayloadSize);
        }