Session sess2 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
Session sess3 = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
ClientSessionInternal coreSession0 = (ClientSessionInternal)((HornetQConnection)conn).getInitialSession();
ClientSessionInternal coreSession1 = (ClientSessionInternal)((HornetQSession)sess1).getCoreSession();
ClientSessionInternal coreSession2 = (ClientSessionInternal)((HornetQSession)sess2).getCoreSession();
ClientSessionInternal coreSession3 = (ClientSessionInternal)((HornetQSession)sess3).getCoreSession();
coreSession0.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));
coreSession1.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));
coreSession2.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));
coreSession3.getConnection().fail(new HornetQException(HornetQException.INTERNAL_ERROR, "blah"));
latch.await(5, TimeUnit.SECONDS);
// Listener should only be called once even if all sessions connections die
Assert.assertEquals(1, listener.numCalls);