docs: private synchronized void onStateChange(PrimitiveState state) {
      if (this.state != state) {
        if (state == PrimitiveState.EXPIRED) {
          if (connected) {
            onStateChange(PrimitiveState.SUSPENDED);
            recover();
          } else {
            log.debug("State changed: {}", state);
            this.state = state;
            stateChangeListeners.forEach(l -> l.accept(state));
          }
        } else {
          log.debug("State changed: {}", state);
          this.state = state;
          stateChangeListeners.forEach(l -> l.accept(state));
          if (state == PrimitiveState.CLOSED) {
            connectFuture = Futures.exceptionalFuture(new PrimitiveException.ClosedSession());
            session = null;
          }
        }
      }
    }