@Test
  public void testPrimaryFailureInUNregisterInterest() throws Exception {
    createClientPoolCache(getName(), NetworkUtils.getServerHostName(server1.getHost()));
    createEntriesK1andK2();
    server1.invoke(HAInterestTestCase::createEntriesK1andK2);
    server2.invoke(HAInterestTestCase::createEntriesK1andK2);
    server3.invoke(HAInterestTestCase::createEntriesK1andK2);

    registerK1AndK2();

    VM oldPrimary = getPrimaryVM();
    stopPrimaryAndUnregisterRegisterK1();

    verifyDeadAndLiveServers(1, 2);

    VM newPrimary = getPrimaryVM(oldPrimary);
    newPrimary.invoke(HAInterestTestCase::verifyDispatcherIsAlive);
    // primary
    newPrimary.invoke(HAInterestTestCase::verifyInterestUNRegistration);
    // secondary
    getBackupVM().invoke(HAInterestTestCase::verifyInterestUNRegistration);
  }
Tests if Primary fails during interest un registration should initiate failover should pick new
primary
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/HAInterestPart2DUnitTest.java