@Override protected void setUp() throws Exception { System.setProperty("brokername", "testbroker"); brokerService = createBroker(); broker = brokerService.getBroker(); // started automatically // brokerService.start(); context = new ConnectionContext(); context.setBroker(broker); info = new ConnectionInfo(); info.setClientId("James"); info.setUserName("James"); info.setConnectionId(new ConnectionId("1234")); try { broker.addConnection(context, info); } catch (Throwable e) { e.printStackTrace(); fail(e.getMessage()); } assertNotNull("No broker created!"); }