@Test
  public void dataReaderCanRegisterAndUnregisterAcrossFailover() throws Exception {
    // Connect to the server that will fail
    ClientVM client = createAndInitializeClientAndCache("dataRead");

    // Client should be able to register and unregister interests.
    client.invoke(() -> {
      Region<String, String> region = ClusterStartupRule.getClientCache().getRegion(regionName);
      region.unregisterInterest(client_k1);
      region.registerInterest(client_k1);
      region.registerInterestRegex("client-.*");
      region.unregisterInterestRegex("client-.*");
    });

    // Initialize client cache and region. Get the port of the primary connected server.
    MemberVM server_to_fail = determinePrimaryServer(client);

    // Bring down primary server
    server_to_fail.stop(true);

    // Confirm failover
    MemberVM secondaryServer = (server1.getPort() == server_to_fail.getPort()) ? server2 : server1;
    await().until(() -> getPrimaryServerPort(client) == secondaryServer.getPort());

    // Confirm permissions.
    client.invoke(() -> {
      Region<String, String> region = ClusterStartupRule.getClientCache().getRegion(regionName);
      region.unregisterInterest(client_k1);
      region.registerInterest(client_k1);
      region.registerInterestRegex("client-.*");
      region.unregisterInterestRegex("client-.*");
    });
  }
This test class reproduces the tests present in
{@link ClientDataAuthorizationUsingLegacySecurityDUnitTest} and confirms that permissions are
maintained over failover.
geode-core/src/upgradeTest/java/org/apache/geode/security/ClientDataAuthorizationUsingLegacySecurityWithFailoverDUnitTest.java