broker = new BrokerService();
broker.setPersistent(false);
broker.setUseJmx(false);
broker.setAdvisorySupport(false);
broker.setDeleteAllMessagesOnStartup(true);
TransportConnector tcpConnector = broker.addConnector(tcpBindAddress);
TransportConnector httpConnector = broker.addConnector(httpBindAddress);
broker.start();
broker.waitUntilStarted();
WaitForJettyListener.waitForJettySocketToAccept(httpConnector.getPublishableConnectString());
tcpConnectionFactory = new ActiveMQConnectionFactory(tcpConnector.getPublishableConnectString());
tcpConnectionFactory.setUseCompression(true);
httpConnectionFactory = new ActiveMQConnectionFactory(httpConnector.getPublishableConnectString());
httpConnectionFactory.setUseCompression(true);
tcpConnection = (ActiveMQConnection) tcpConnectionFactory.createConnection();
httpConnection = (ActiveMQConnection) httpConnectionFactory.createConnection();
tcpSession = tcpConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);
httpSession = httpConnection.createSession(false, Session.AUTO_ACKNOWLEDGE);