DetectingGateway gateway = startDetectingGateway();
final ShutdownTracker tracker = new ShutdownTracker();
// Run some concurrent load against the broker via the gateway...
final StompJmsConnectionFactory factory = new StompJmsConnectionFactory();
factory.setBrokerURI("tcp://localhost:"+gateway.getBoundPort());
for(int client=0; client<10; client++) {
new Thread("JMS Client: "+client) {
@Override
public void run() {
while(tracker.attemptRetain()) {
try {
Connection connection = factory.createConnection();
Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
MessageConsumer consumer = session.createConsumer(session.createTopic("FOO"));
MessageProducer producer = session.createProducer(session.createTopic("FOO"));
producer.send(session.createTextMessage("Hello"));
consumer.receive(1000);