private static void verifyDurableCqs(final List<String> durableCqNames,
      final String registeredCqName) {
    // Verify the number of durable CQ names is one, and it matches the registered name
    assertThat(durableCqNames).hasSize(1);
    String returnedCqName = durableCqNames.get(0);
    assertThat(registeredCqName).isEqualTo(returnedCqName);

    // Get client's primary server
    PoolImpl pool = getPool();
    ServerLocation primaryServerLocation = pool.getPrimary();

    // Verify the primary server was used and no other server was used
    Map<ServerLocationAndMemberId, ConnectionStats> statistics =
        pool.getEndpointManager().getAllStats();
    for (Map.Entry<ServerLocationAndMemberId, ConnectionStats> entry : statistics.entrySet()) {
      int expectedGetDurableCqInvocations =
          entry.getKey().getServerLocation().equals(primaryServerLocation) ? 1 : 0;
      assertThat(entry.getValue().getGetDurableCqs()).isEqualTo(expectedGetDurableCqInvocations);
    }
  }
Tests situation where a client is trying to reconnect while a cq is being drained
geode-cq/src/distributedTest/java/org/apache/geode/internal/cache/tier/sockets/DurableClientCQDUnitTest.java