/** testcase for http://jira.jboss.com/jira/browse/JBMESSAGING-1038 */
public void testHopping() throws Exception
{
JBossConnectionFactory localcf = (JBossConnectionFactory)ic[0].lookup("/ClusteredConnectionFactory");
ClientClusteredConnectionFactoryDelegate cfdelegate = (ClientClusteredConnectionFactoryDelegate)localcf.getDelegate();
((ClientClusteredConnectionFactoryDelegate)cf.getDelegate()).closeCallback(false);
// After this, the CF won't get any callbacks
cfdelegate.closeCallback(false);
Connection conn = createConnectionOnServer(localcf, 1);
try
{
Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageProducer producer = sess.createProducer(queue[1]);
MessageConsumer consumer = sess.createConsumer(queue[1]);
conn.start();
producer.send(sess.createTextMessage("sent before kill"));
TextMessage msg = (TextMessage)consumer.receive(2000);
assertNotNull(msg);
assertEquals("sent before kill", msg.getText());
ServerManagement.kill(2);
ServerManagement.kill(1);
// We need to guarantee we still have the old failover map (before the topology change for the test to be valid)
assertEquals(3, cfdelegate.getDelegates().length);
log.info("Sending Message");
producer.send(sess.createTextMessage("sent after kill"));
msg = (TextMessage) consumer.receive(2000);