public static void verifyEventIdsOnClient2() {
    await("Waiting for proceedForValidation to be true")
        .until(() -> proceedForValidation);

    LogWriterUtils.getLogWriter().info("Starting validation on client2");
    if (validationFailed) {
      fail(
          "\n The following eventIds received by client2 were not present in the eventId array sent by client1 \n"
              + failureMsg);
    }
    LogWriterUtils.getLogWriter()
        .info("Validation complete on client2, goin to unregister listeners");

    Region region = cache.getRegion(SEPARATOR + REGION_NAME);
    if (region != null && !region.isDestroyed()) {
      try {
        AttributesMutator mutator = region.getAttributesMutator();
        mutator.initCacheListeners(null);
      } catch (RegionDestroyedException ignore) {
      }
    }

    for (int i = 0; i < eventIds.length; i++) {
      region = cache.getRegion(SEPARATOR + REGION_NAME + i);
      if (region != null && !region.isDestroyed()) {
        try {
          AttributesMutator mutator = region.getAttributesMutator();
          mutator.initCacheListeners(null);
        } catch (RegionDestroyedException ignore) {
        }
      }
    }

    LogWriterUtils.getLogWriter().info("Test completed, Unregistered the listeners");
  }
Waits for the listener to receive all events and validates that no exception occurred in client
geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/EventIdOptimizationDUnitTest.java