@Override
  @After
  public void tearDown() throws Exception {
    try {
      pooledFactory.stop();
    } catch (Exception ex) {
      // ignored
    }

    super.tearDown();
  }
  @Override
  @Before
  public void setUp() throws Exception {
    super.setUp();

    brokerService = new BrokerService();
    brokerService.setUseJmx(false);
    brokerService.setPersistent(false);
    brokerService.setSchedulerSupport(false);
    brokerService.setAdvisorySupport(false);
    TransportConnector connector = brokerService.addConnector("tcp://localhost:0");
    brokerService.start();
    factory = new ActiveMQConnectionFactory("mock:" + connector.getConnectUri());
    pooledFactory = new PooledConnectionFactory();
    pooledFactory.setConnectionFactory(factory);
    pooledFactory.setMaxConnections(1);
  }