How to reset the Websocket (data) connection with the Java sdk

I’m working with the market streams.

It happens the connection is lost, long time before the 24h.

So I thought to re-create it eveny now an then. To protect my self from unexpected live data loss. But that doesn’t work.

I always get a:

[ERROR] 2022-01-13 02:46:10.460 [pool-5-thread-2] WebSocketConnection - [Connection 4] Failure
java.io.InterruptedIOException: executor rejected
at okhttp3.internal.connection.RealCall$AsyncCall.executeOn(RealCall.kt:501) ~[okhttp-4.9.2.jar:?]
at okhttp3.Dispatcher.promoteAndExecute(Dispatcher.kt:184) ~[okhttp-4.9.2.jar:?]

Tried with the same WebsocketClientImpl instance and with a new one also and both doesn’t work.

Any help on how rest ones connection with the binance java sdk?

Thanks,

Try calling the closeAllConnections() method before creating another instance.

That’s exactly what I did first.

I could never reconnect after I’ve callled the closeAllConnections().

With the same client, with a new client. No one could connect.

Strangely, when I don’t closeAllConnections(), I try to create another connection, it passes!

I realized that closeAllConnections() was preventing future connections!

Others thoughts about this?

Thanks.