code: void gotoState(@Nonnull ConnectivityState newState) {
      checkNotNull(newState, "newState");
      if (state != newState && state != ConnectivityState.SHUTDOWN) {
        state = newState;
        if (listeners.isEmpty()) {
          return;
        }
        // Swap out callback list before calling them, because a callback may register new callbacks,
        // if run in direct executor, can cause ConcurrentModificationException.
        ArrayList<Listener> savedListeners = listeners;
        listeners = new ArrayList<>();
        for (Listener listener : savedListeners) {
          listener.runInExecutor();
        }
      }
    }
docs: Connectivity state is changed to the specified value. Will trigger some notifications that have
  been registered earlier by {@link ManagedChannel#notifyWhenStateChanged}.