}
// add a dummy server-side ConnectionListener, to enable leasing on server
ServerManagement.invoke(ServiceContainer.REMOTING_OBJECT_NAME, "addConnectionListener",
new Object[] { new SimpleConnectionListener() },
new String[] {"org.jboss.remoting.ConnectionListener"});
// enable leasing on client
Map conf = new HashMap();
conf.put(Client.ENABLE_LEASE, Boolean.TRUE);
conf.put(InvokerLocator.CLIENT_LEASE_PERIOD, "999");
Client client = new Client(serverLocator, RemotingTestSubsystemService.SUBSYSTEM_LABEL, conf);
client.connect();
SimpleConnectionListener connListener = new SimpleConnectionListener();
client.addConnectionListener(connListener);
ServerManagement.kill(0);
// wait until failure is detected
Throwable failure = connListener.getNextFailure(3000);
assertNotNull(failure);
// we simulate what Messaging is doing and we
client.setDisconnectTimeout(0);