Map clientEnv = getEnvironment();
clientEnv.put(MX4JRemoteConstants.CONNECTION_HEARTBEAT_PERIOD, new Long(period));
clientEnv.put(MX4JRemoteConstants.CONNECTION_HEARTBEAT_RETRIES, new Integer(retries));
cntor.connect(clientEnv);
JMXConnectionNotification notification = (JMXConnectionNotification) holder.get();
assertEquals(notification.getType(), JMXConnectionNotification.OPENED);
holder.set(null);
} catch (Exception x)
{
x.printStackTrace();
throw x;
} finally
{
cntorServer.stop();
sleep(5000);
}
// Wait for the heartbeat to send the failed notification
sleep((retries * 3) * period);
JMXConnectionNotification notification = (JMXConnectionNotification) holder.get();
assertNotNull(notification);
assertEquals(notification.getType(), JMXConnectionNotification.FAILED);
}