public static Broker createBrokerMock()
{
SubjectCreator subjectCreator = mock(SubjectCreator.class);
when(subjectCreator.getMechanisms()).thenReturn("");
Broker broker = mock(Broker.class);
when(broker.getAttribute(Broker.CONNECTION_SESSION_COUNT_LIMIT)).thenReturn(1);
when(broker.getAttribute(Broker.VIRTUALHOST_HOUSEKEEPING_CHECK_PERIOD)).thenReturn(10000l);
when(broker.getId()).thenReturn(UUID.randomUUID());
when(broker.getSubjectCreator(any(SocketAddress.class))).thenReturn(subjectCreator);
RootMessageLogger rootMessageLogger = CurrentActor.get().getRootMessageLogger();
when(broker.getRootMessageLogger()).thenReturn(rootMessageLogger);
when(broker.getVirtualHostRegistry()).thenReturn(new VirtualHostRegistry());
when(broker.getSecurityManager()).thenReturn(new SecurityManager(mock(Broker.class), false));
GenericActor.setDefaultMessageLogger(rootMessageLogger);
return broker;
}