Skip to content

Commit

Permalink
Add Retry and Task.Delay to WinHttpHandler AfterReadResponseServerErr…
Browse files Browse the repository at this point in the history
…or_ClientWrite test (#90824)

* Add Task.Delay to give more time for reset frame

* Apply @JamesNK' solution
  • Loading branch information
liveans authored Aug 21, 2023
1 parent 3c3f499 commit 3525ace
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,17 @@ public async Task AfterReadResponseServerError_ClientWrite()
// Server sends RST_STREAM.
await connection.WriteFrameAsync(new RstStreamFrame(FrameFlags.EndStream, 0, streamId));

await Assert.ThrowsAsync<IOException>(() => requestStream.WriteAsync(new byte[50]).AsTask());
await Assert.ThrowsAsync<IOException>(async () =>
{
for (int i = 0; i < 10; i++)
{
await requestStream.WriteAsync(new byte[50]);
// WriteAsync succeeded because handler hasn't processed RST_STREAM yet.
// Small wait before trying again.
await Task.Delay(50);
}
});
}
}

Expand Down

0 comments on commit 3525ace

Please sign in to comment.