/**
* Receive new messages from server, returns if no new message arrive in a timespan of timeout.
*/
- void receiveMessages(Duration timeout, ReceiveMessageHandler handler) throws IOException;
-
- /**
- * Receive new messages from server, returns only if the thread is interrupted.
- */
- void receiveMessages(ReceiveMessageHandler handler) throws IOException;
+ public void receiveMessages(
+ Optional<Duration> timeout, Optional<Integer> maxMessages, ReceiveMessageHandler handler
+ ) throws IOException;
void setReceiveConfig(ReceiveConfig receiveConfig);