public ValueTask <long> GetPingPongPayloadSize() { return(StubHttpMessageHandler.GetPayloadSize(channel => { var proxy = channel.CreateGrpcService <ITestService>(); return proxy.PingPong(_payload); })); }
public ValueTask <long> GetPingPongPayloadSize() { return(StubHttpMessageHandler.GetPayloadSize(channel => { var proxy = _clientFactory.CreateClient <ITestService>(channel); return proxy.PingPong(_payload); })); }
public ValueTask <long> GetPingPongPayloadSize() { return(StubHttpMessageHandler.GetPayloadSize(channel => { var proxy = new TestServiceNative.TestServiceNativeClient(channel); return proxy.PingPongAsync(_payload).ResponseAsync; })); }
public ValueTask <long> GetPingPongPayloadSize() { return(StubHttpMessageHandler.GetPayloadSize(async channel => { var proxy = MagicOnion.Client.MagicOnionClient.Create <ITestServiceMagicOnion>(channel); var call = proxy.PingPong(_payload); await call; })); }
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); }