diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs index 3d0d0d10ba3b..3025786e5350 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs @@ -3549,11 +3549,12 @@ public async Task RST_STREAM_IncompleteRequest_AdditionalDataFrames_ConnectionAb await SendDataAsync(1, new byte[2], endStream: false); await SendRstStreamAsync(1); await SendDataAsync(1, new byte[10], endStream: false); - tcs.TrySetResult(); await WaitForConnectionErrorAsync(ignoreNonGoAwayFrames: false, expectedLastStreamId: 1, Http2ErrorCode.STREAM_CLOSED, CoreStrings.FormatHttp2ErrorStreamAborted(Http2FrameType.DATA, 1)); + tcs.TrySetResult(); // Don't let the response start until after the abort + AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose); } @@ -3575,11 +3576,12 @@ public async Task RST_STREAM_IncompleteRequest_AdditionalTrailerFrames_Connectio await SendDataAsync(1, new byte[2], endStream: false); await SendRstStreamAsync(1); await SendHeadersAsync(1, Http2HeadersFrameFlags.END_HEADERS | Http2HeadersFrameFlags.END_STREAM, _requestTrailers); - tcs.TrySetResult(); await WaitForConnectionErrorAsync(ignoreNonGoAwayFrames: false, expectedLastStreamId: 1, Http2ErrorCode.STREAM_CLOSED, CoreStrings.FormatHttp2ErrorStreamAborted(Http2FrameType.HEADERS, 1)); + tcs.TrySetResult(); // Don't let the response start until after the abort + AssertConnectionEndReason(ConnectionEndReason.FrameAfterStreamClose); }