The test intends to test where Envoy receives reset while the response end_stream is already buffered. While currently there is a race between the stream reset from the client and end_stream from upstream.    So my suggestion is to wait for the upstream to finish sending the response to Envoy before client reset the stream. And the upstream stream connection close can be an indicator of that.