public static void closeCache() {
    if (cache != null && !cache.isClosed()) {
      PoolImpl.AFTER_PRIMARY_IDENTIFICATION_FROM_BACKUP_CALLBACK_FLAG = false;
      HAStartupAndFailoverDUnitTest.identifiedPrimary = false;
      cache.close();
      cache.getDistributedSystem().disconnect();
    }
  }
Tests failover initialization by cache operation Threads on secondary
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/HAStartupAndFailoverDUnitTest.java