T t = new T();
t.start();
TestListener listener = new TestListener();
SocketFactory sf = getSocketFactory();
SocketFactory clsf = new CreationListenerSocketFactory(sf, listener);
assertFalse(listener.visited());
clsf.createSocket();
assertTrue(listener.visited());
listener.reset();
assertFalse(listener.visited());
clsf.createSocket(host, port);
assertTrue(listener.visited());
listener.reset();
assertFalse(listener.visited());
clsf.createSocket(host, port, address, PortUtil.findFreePort(host));
assertTrue(listener.visited());
listener.reset();
assertFalse(listener.visited());
clsf.createSocket(address, port);
assertTrue(listener.visited());
listener.reset();
assertFalse(listener.visited());
clsf.createSocket(address, port, address, PortUtil.findFreePort(host));
assertTrue(listener.visited());
assertTrue(!t.failed());
t.shutdown();