} catch(Error e) {
System.out.println("Factory already defined, move along");
}
EventCollector eventCollector = (EventCollector)testManager.waitForService(EventCollector.class);
Assert.assertNotNull(eventCollector);
EventCollectorRegistration registration1 = eventCollector.register(Lease.ANY);
EventCollectorRegistration registration2 = eventCollector.register(Lease.ANY);
BasicEventListener listener1 = new BasicEventListener();
RemoteEventListener eventListener = listener1.export();
registration1.enableDelivery(eventListener);
try {
logger.info("Deploy ....");
testManager.deploy(new File("src/test/opstring/outrigger.groovy"));
logger.info("Wait 3 seconds to get events.... ");
Thread.sleep(1000*3);
registration1.disableDelivery();
Thread.sleep(1000*3);
testManager.undeploy("Outrigger");
logger.info("Wait 3 seconds to get events for next client.... ");
Thread.sleep(1000*3);
registration1.enableDelivery(eventListener);
BasicEventListener listener2 = new BasicEventListener();
registration2.enableDelivery(listener2.export());
logger.info("Wait 3 seconds to clean up");
Thread.sleep(1000 * 3);
log(1, listener1);
log(2, listener2);
Assert.assertEquals(listener1.eventCollectionCount(), listener2.eventCollectionCount());