public void StreamErrorShouldNotFireExceptionForOutbound() { _frameInboundWriter.WriteInboundHeaders(3, _request, 31, false); IHttp2Stream stream = _frameCodec.Connection.Stream(3); Assert.NotNull(stream); StreamException streamEx = new StreamException(3, Http2Error.InternalError, "foo"); _frameCodec.OnError(_frameCodec._ctx, true, streamEx); Http2FrameStreamEvent evt = _inboundHandler.ReadInboundMessageOrUserEvent <Http2FrameStreamEvent>(); Assert.Equal(Http2FrameStreamEvent.EventType.State, evt.Type); Assert.Equal(Http2StreamState.Open, evt.Stream.State); IHttp2HeadersFrame headersFrame = _inboundHandler.ReadInboundMessageOrUserEvent <IHttp2HeadersFrame>(); Assert.NotNull(headersFrame); // No exception expected _inboundHandler.CheckException(); Assert.Null(_inboundHandler.ReadInboundMessageOrUserEvent <object>()); }
public void StreamErrorShouldFireExceptionForInbound() { _frameInboundWriter.WriteInboundHeaders(3, _request, 31, false); IHttp2Stream stream = _frameCodec.Connection.Stream(3); Assert.NotNull(stream); StreamException streamEx = new StreamException(3, Http2Error.InternalError, "foo"); _channel.Pipeline.FireExceptionCaught(streamEx); Http2FrameStreamEvent evt = _inboundHandler.ReadInboundMessageOrUserEvent <Http2FrameStreamEvent>(); Assert.Equal(Http2FrameStreamEvent.EventType.State, evt.Type); Assert.Equal(Http2StreamState.Open, evt.Stream.State); IHttp2HeadersFrame headersFrame = _inboundHandler.ReadInboundMessageOrUserEvent <IHttp2HeadersFrame>(); Assert.NotNull(headersFrame); try { _inboundHandler.CheckException(); Assert.False(true, "stream exception expected"); } catch (Http2FrameStreamException e) { Assert.Equal(streamEx, e.InnerException); } Assert.Null(_inboundHandler.ReadInboundMessageOrUserEvent <object>()); }