Session sess = conn.createSession(false, Session.AUTO_ACKNOWLEDGE);
ClientSession coreSession = ((HornetQSession)sess).getCoreSession();
RemotingConnection coreConn = ((ClientSessionInternal)coreSession).getConnection();
SimpleString jmsQueueName = new SimpleString(HornetQDestination.JMS_QUEUE_ADDRESS_PREFIX + "myqueue");
coreSession.createQueue(jmsQueueName, jmsQueueName, null, true);
Queue queue = sess.createQueue("myqueue");
MessageProducer producer = sess.createProducer(queue);
producer.setDeliveryMode(DeliveryMode.PERSISTENT);
MessageConsumer consumer = sess.createConsumer(queue);
byte[] body = RandomUtil.randomBytes(bodySize);
for (int i = 0; i < numMessages; i++)
{
BytesMessage bm = sess.createBytesMessage();
bm.writeBytes(body);
producer.send(bm);
}
conn.start();
Thread.sleep(2000);
HornetQException me = new HornetQException(HornetQException.NOT_CONNECTED);
coreConn.fail(me);
//It should reconnect to the same node
for (int i = 0; i < numMessages; i++)
{