@Override
    public void onMessage(String s) {
        log.debug("Received message {} from server {}", s, uri);
        listenerOpt.ifPresent(
                listener -> {
                    try {
                        listener.onMessage(s);
                    } catch (Exception e) {
                        log.error("Failed to process message '{}' from server {}", s, uri, e);
                    }
                });
    }
@Test
    public void testNotifyListenerOnMessage() throws Exception {
        client.onMessage("message");

        verify(listener).onMessage("message");
    }