code: protected void processConnection(WatchedEvent event) {
      switch (event.getState()) {
      case SyncConnected:
        LOG.info(hostPort.getHostPort() + " sync connect from ZooKeeper");
        try {
          waitToInitZooKeeper(2000); // init zookeeper in another thread, wait for a while
        } catch (Exception e) {
          LOG.fatal("Error to init ZooKeeper object after sleeping 2000 ms, exit immediately");
          System.exit(0);
        } 
        break;
      case Disconnected: // be triggered when kill the server or the leader of zk cluster 
        LOG.warn(hostPort.getHostPort() + " received disconnected from ZooKeeper");
        break;
      case AuthFailed:
        LOG.fatal(hostPort.getHostPort() + " auth fail, exit immediately");
        System.exit(0);
      case Expired:
        LOG.fatal(hostPort.getHostPort() + " received expired from ZooKeeper, exit immediately");
        System.exit(0);
        break;
      default:
        break;
      }
    }
docs: Deal with connection event, exit current process if auth fails or session expires.
  
  @param event the ZooKeeper event