@Override
    public void onClose(int code, String reason, boolean remote) {
        log.debug(
                "Closed WebSocket connection to {}, because of reason: '{}'."
                        + "Connection closed remotely: {}",
                uri,
                reason,
                remote);
        listenerOpt.ifPresent(WebSocketListener::onClose);
    }
@Test
    public void testNotifyListenerOnClose() throws Exception {
        client.onClose(1, "reason", true);

        verify(listener).onClose();
    }