### Question:
ClusteredStatReplicator implements StatReplicator, ServiceChangedEventChannel { @Override public void servicePoolChanged(final String serviceName) { if (this.serviceName.equals(serviceName)) { logger.info("ClusteredStatReplicator::servicePoolChanged({})", serviceName); updateServicePool(serviceName); } else if (debug) { logger.debug("ClusteredStatReplicator::servicePoolChanged({})", "got event for another service", serviceName); } } ClusteredStatReplicator(final String serviceName,
                                   final ServiceDiscovery serviceDiscovery,
                                   final StatReplicatorProvider statReplicatorProvider,
                                   final String localServiceId,
                                   final Timer timer,
                                   final int tallyInterval,
                                   final int flushInterval); @Override void replicateCount(final String name, final long count, final long now); @Override void replicateLevel(final String name, long level, long time); @Override void replicateTiming(String name, long level, long time); void doCheckReconnect(); @Override void servicePoolChanged(final String serviceName); @Override void flush();  }### Answer:
@Test public void testDiscovery() { EndpointDefinition endpointDefinition1 = serviceDefinition(serviceName, "host1"); EndpointDefinition endpointDefinition2 = serviceDefinition(serviceName, "host2"); EndpointDefinition endpointDefinition3 = serviceDefinition(serviceName, "host3"); List<EndpointDefinition> fooServices = serviceDefinitions( endpointDefinition1, endpointDefinition2, endpointDefinition3 ); services.set(fooServices); clusteredStatReplicator.servicePoolChanged(serviceName); Sys.sleep(100); final DebugReplicator debugReplicator1 = statReplicatorMap.get(endpointDefinition1.getId()); final DebugReplicator debugReplicator2 = statReplicatorMap.get(endpointDefinition1.getId()); final DebugReplicator debugReplicator3 = statReplicatorMap.get(endpointDefinition1.getId()); assertNotNull(debugReplicator1); assertNotNull(debugReplicator2); assertNotNull(debugReplicator3); }