void () { if (isConnected()) { disconnect(); } if (getSession().isSuspended()) { getSession().resume(); } if (!isWaitingForConnection()) { setWaitingForConnection(true); ApplicationManager.getApplication().invokeLater(() -> waitForConnection(getCurrentStateMessage(), getConnectionTitle()), ModalityState.defaultModalityState()); } }