I am using RestSharp as the underlying HTTP library to stress test a black box service, I notice that after a while, even when testing has stop, the .NET process that runs the test/RestSharp keeps a lot of connections open. Since the Servicepoint limit has been lifted, it could be thousands of connections. If the test is sustained (continuous new requests), the response from the server will eventually grind to a halt for several seconds perhaps up to a minute, before exceptions with the connection happen.
Error 0 0
The underlying connection was closed: A connection that was expected to be kept alive was closed by the server.
at RestSharp.Http.GetRawResponseAsync(IAsyncResult result, Action`1 callback)
at RestSharp.Http.ResponseCallback(IAsyncResult result, Action`1 callback)
Error 0 0
The underlying connection was closed: An unexpected error occurred on a receive.
at RestSharp.Http.GetRawResponseAsync(IAsyncResult result, Action`1 callback)
at RestSharp.Http.ResponseCallback(IAsyncResult result, Action`1 callback)
After a couple of hundreds of such errors, the client would be able to continue with its sustain rate of new requests and regular server response.
I am wondering how to disable HTTP keep-alive, in order to observe what kind of different behaviour may result from that?
thanks,
Aaron