public static void setClientServerObserver() {
    PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = true;
    ClientServerObserverHolder.setInstance(new ClientServerObserverAdapter() {
      @Override
      public void afterPrimaryIdentificationFromBackup(ServerLocation primaryEndpoint) {
        synchronized (HAStartupAndFailoverDUnitTest.class) {
          HAStartupAndFailoverDUnitTest.identifiedPrimary = true;
          HAStartupAndFailoverDUnitTest.class.notifyAll();
        }
      }
    });
  }
Tests failover initialization by cache operation Threads on secondary
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java