// have persistence messages as a default
System.setProperty("activemq.persistenceAdapter",
"org.codehaus.activemq.store.vm.VMPersistenceAdapter");
// configuration of container and all protocolls
BrokerContainerImpl container = createBroker();
// start a client
ActiveMQConnectionFactory factory = new
ActiveMQConnectionFactory("tcp://localhost:9100");
factory.start();
factory.createConnection();
// stop activemq broker
container.stop();
// start activemq broker again
container = createBroker();
// start a client again
factory = new
ActiveMQConnectionFactory("tcp://localhost:9100");
factory.start();
factory.createConnection();
// stop activemq broker
container.stop();
}