@Override
		public synchronized void childEvent(CuratorFramework client, PathChildrenCacheEvent event) throws Exception {
			System.out.println(event);
			System.out.println(event.getData() != null ? new String(event.getData().getData()) : "no data");
			switch (event.getType()) {
				case CHILD_ADDED:
					actual++;
					if (ready && actual == expected) {
						System.out.println("*** Moving on... ");
						this.notify();
					}
					break;
				case CHILD_REMOVED:
					actual--;
					break;
				case INITIALIZED:
					Assert.isTrue(actual == expected);
					ready = true;
					this.notify();
					break;
			}
		}
See XD-2293. This is used to reproduce Kafka rebalance issues.
spring-xd-dirt/src/test/java/org/springframework/xd/dirt/integration/kafka/TestKafkaCluster.java