code: private void setState(State state) {
      if (this.state != state) {
        this.state = state;
        LOGGER.debug("State changed: {}", state);
        changeListeners.forEach(l -> l.accept(state));
      }
    }
docs: Updates the client state.