@Test public void cancelStreamShouldCreateAndThenFailBufferedStream() throws Exception { receiveMaxConcurrentStreams(0); enqueue(newCreateStreamCommand(grpcHeaders, streamTransportState)); assertEquals(3, streamTransportState.id()); cancelStream(Status.CANCELLED); verify(streamListener).closed(eq(Status.CANCELLED), same(PROCESSED), any(Metadata.class)); }
private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise); }
NettyClientHandler extends AbstractNettyHandler { private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise); } }
NettyClientHandler extends AbstractNettyHandler { private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise); } private  NettyClientHandler(
      Http2ConnectionDecoder decoder,
      StreamBufferingEncoder encoder,
      Http2Settings settings,
      ClientTransportLifecycleManager lifecycleManager,
      KeepAliveManager keepAliveManager,
      Supplier<Stopwatch> stopwatchFactory,
      final Runnable tooManyPingsRunnable,
      TransportTracer transportTracer,
      Attributes eagAttributes,
      String authority); }
NettyClientHandler extends AbstractNettyHandler { private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise); } private  NettyClientHandler(
      Http2ConnectionDecoder decoder,
      StreamBufferingEncoder encoder,
      Http2Settings settings,
      ClientTransportLifecycleManager lifecycleManager,
      KeepAliveManager keepAliveManager,
      Supplier<Stopwatch> stopwatchFactory,
      final Runnable tooManyPingsRunnable,
      TransportTracer transportTracer,
      Attributes eagAttributes,
      String authority); @Override void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise); @Override void close(ChannelHandlerContext ctx, ChannelPromise promise); @Override void channelInactive(ChannelHandlerContext ctx); @Override void handleProtocolNegotiationCompleted(
      Attributes attributes, InternalChannelz.Security securityInfo); @Override Attributes getEagAttributes(); @Override String getAuthority(); }
NettyClientHandler extends AbstractNettyHandler { private void cancelStream(ChannelHandlerContext ctx, CancelClientStreamCommand cmd, ChannelPromise promise) { NettyClientStream.TransportState stream = cmd.stream(); Status reason = cmd.reason(); if (reason != null) { stream.transportReportStatus(reason, true, new Metadata()); } encoder().writeRstStream(ctx, stream.id(), Http2Error.CANCEL.code(), promise); } private  NettyClientHandler(
      Http2ConnectionDecoder decoder,
      StreamBufferingEncoder encoder,
      Http2Settings settings,
      ClientTransportLifecycleManager lifecycleManager,
      KeepAliveManager keepAliveManager,
      Supplier<Stopwatch> stopwatchFactory,
      final Runnable tooManyPingsRunnable,
      TransportTracer transportTracer,
      Attributes eagAttributes,
      String authority); @Override void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise); @Override void close(ChannelHandlerContext ctx, ChannelPromise promise); @Override void channelInactive(ChannelHandlerContext ctx); @Override void handleProtocolNegotiationCompleted(
      Attributes attributes, InternalChannelz.Security securityInfo); @Override Attributes getEagAttributes(); @Override String getAuthority();  }