Fix flaky URLConnectionTest.serverShutdownOutput test #4469
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are usually 2 requests sent to '/b' during the test:
#1 on the busted connection, attempting reuse
#2 on a new connection
On successful runs, the server recorded #1 and then #2 and added them to the queue in that order.
On failed runs, the server started reading request #1 before #2, but there was a context switch, and it finished reading #2 before #1, recording them in that order. Since #1 was the last to be recorded, the test incorrectly used it to assert that the sequence number was 0. Since #1 was the second to be received on the busted connection, it had a sequence number of 1 so the test failed.
The fix removes the assumption that #2 is the last to be recorded.
Fixes #4140.