@Before
  public void setUp() throws Exception {

    createAndStartBroker();

    connectionInfo = new ActiveMQConnectionRequestInfo();
    connectionInfo.setServerUrl(BROKER_URL);
    connectionInfo.setUserName(ActiveMQConnectionFactory.DEFAULT_USER);
    connectionInfo.setPassword(ActiveMQConnectionFactory.DEFAULT_PASSWORD);

    managedConnectionFactory = new ActiveMQManagedConnectionFactory();
    managedConnection = managedConnectionFactory.createManagedConnection(null, connectionInfo);

    connections = new HashSet<ManagedConnection>();
    connections.add(managedConnection);
  }
 private void createConnectionAndProxyAndSession() throws Exception {
   managedConnection =
       managedConnectionFactory.matchManagedConnections(connections, null, connectionInfo);
   proxy = (ManagedConnectionProxy) managedConnection.getConnection(null, null);
   proxy.createSession(false, 0);
 }