assertEquals(adaptor.lastSent,mp.lastReceived.get());
// now go into a disruption loop
ClusterInfoSession session = TestUtils.getSession(dempsy.getCluster(new ClusterId("test-app","test-cluster1")));
assertNotNull(session);
DisruptibleSession dsess = (DisruptibleSession) session;
final AtomicBoolean stopSending = new AtomicBoolean(false);
Thread thread = new Thread(new Runnable()
{
@Override
public void run()
{
long count = 0;
while (!stopSending.get())
{
adaptor.pushMessage(new TestMessage("Hello:" + count++));
try { Thread.sleep(1); } catch (Throwable th) {}
}
}
});
thread.setDaemon(true);
thread.start();
for (int i = 0; i < 10; i++)
{
logger.trace("=========================");
dsess.disrupt();
// now wait until more messages come through
final long curCount = mp.handleCalls.get();
assertTrue(poll(baseTimeoutMillis,mp, new Condition<TestMp>() { @Override public boolean conditionMet(TestMp mp) { return mp.handleCalls.get() > curCount; } }));
}