public static void validateReceivedEventsMapSizeListener1(final String senderId, final Map map) {

    Set<GatewaySender> senders = cache.getGatewaySenders();
    GatewaySender sender = null;
    for (GatewaySender s : senders) {
      if (s.getId().equals(senderId)) {
        sender = s;
        break;
      }
    }

    final List<AsyncEventListener> listeners =
        ((AbstractGatewaySender) sender).getAsyncEventListeners();
    if (listeners.size() == 1) {
      final AsyncEventListener l = listeners.get(0);

      WaitCriterion wc = new WaitCriterion() {
        Map listenerMap;

        @Override
        public boolean done() {
          listenerMap = ((MyGatewaySenderEventListener) l).getEventsMap();
          boolean sizeCorrect = map.size() == listenerMap.size();
          boolean keySetCorrect = listenerMap.keySet().containsAll(map.keySet());
          boolean valuesCorrect = listenerMap.values().containsAll(map.values());
          return sizeCorrect && keySetCorrect && valuesCorrect;
        }

        @Override
        public String description() {
          return "Waiting for all sites to get updated, the sizes are " + listenerMap.size()
              + " and " + map.size();
        }
      };
      GeodeAwaitility.await().untilAsserted(wc);
    }
  }
Test validates whether the PoolImpl is created. Ideally when a listener is attached pool should
not be created.
geode-wan/src/distributedTest/java/org/apache/geode/internal/cache/wan/serial/SerialGatewaySenderEventListenerDUnitTest.java