Keep alive limitations
As issue #3052 was closed I am creating a new one.
I am encountering weird connection persistence behavior at least with Binance (I haven't tried other exchanges yet).
If the interval between the API calls is less than 5 seconds, the connection is reused without any problem.
However if it is longer, the first connection is actively closed (I can intercept the tcp FIN in the trafic) by the client somehow just before the subsequent call.
To my knowledge there is no argument/property to specify the max duration of persistent connections at the level of ResCU, HTTPClient or the JVM.
I've checked my OS settings and I've got the default value of 7200 seconds.
Regarding the HTTP headers, Binance does respond with Connection: keep-alive, but does not provide any Keep-Alive header.
Any idea as where this 5 seconds value can be changed?
I've tried a lot of things, but the connections are never persisted more than a few seconds with HttpsURLConnection no matter what JVM (openjdk 11-17, oracle 11-17) and what settings I am using.
This is clearly an issue that has been encountered by other many time over the years.
I quickly modified ResCU to use OKHttp client instead of HttpsURLConnection and it just works flawlessly without any custom configuration.
I am going to open an issue about that on https://github.com/mmazi/rescu requesting the support of an alternative http client, HttpsURLConnection being clearly not flexible enough (even broken in my opinion).