diff --git a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs index 9ab5ceaa4d52..338879c67a92 100644 --- a/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs +++ b/src/Servers/Kestrel/test/InMemory.FunctionalTests/Http2/Http2ConnectionTests.cs @@ -3541,11 +3541,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); } @@ -3567,11 +3568,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); }