Since the Lightstreamer Client API is asynchronous, blocking its threads can have unexpected results.
However you can set a timeout by using a java.util.Timer (or equivalent asynchronous mechanism).
For example:
Code:var client = new LightstreamerClient(...) Timer timer = new Timer(); timer.schedule(() -> { if (!client.getStatus().startsWith("CONNECTED")) { client.disconnect(); } }, TIMEOUT); client.connect();
Bookmarks