public static void main(String... args) throws InterruptedException {
		MockBrokerHandler handler = new GlamBrokerHandler();
		MockBroker broker = new MockBroker(handler);

		broker.init(); // Blocks until startup is complete.

		// At this point the broker is online. Clients can connect to it, publish messages, subscribe, etc.
		Thread.sleep(60000);

		// Examine broker events and report some useful stats about them.
		List<BrokerEvent> events = broker.getEvents();
		Set<String> clientIds = new HashSet<String>();
		Map<BrokerEventType,Integer> eventTypes = new EnumMap<BrokerEventType, Integer>(BrokerEventType.class);
		Map<MessageType,Integer> messageTypes = new EnumMap<MessageType, Integer>(MessageType.class);
		for (BrokerEvent event : events) {
			clientIds.add(event.getClientId());

			BrokerEventType brokerEventType = event.getEventType();
			Integer brokerEventCount = eventTypes.get(brokerEventType);
			if (brokerEventCount == null) {
				brokerEventCount = Integer.valueOf(0);
			}
			eventTypes.put(brokerEventType, Integer.valueOf(brokerEventCount.intValue() + 1));

			MessageType messageType = event.getMessage().getMessageType();
			Integer messageTypeCount = messageTypes.get(messageType);
			if (messageTypeCount == null) {
				messageTypeCount = Integer.valueOf(0);
			}
			messageTypes.put(messageType, Integer.valueOf(messageTypeCount.intValue() + 1));
		}
		System.out.printf("Total events: %d\n", events.size());
		System.out.printf("Total client IDs: %d\n", clientIds.size());

		System.out.println("Counts by broker event type:");
		for (Entry entry : eventTypes.entrySet()) {
			System.out.printf("\t%s: %d\n", ((Charset) entry.getKey()).name(), entry.getValue());
		}

		System.out.printf("Counts by MQTT message type:");
		for (Entry entry : messageTypes.entrySet()) {
			System.out.printf("\t%s: %d\n", ((Charset) entry.getKey()).name(), entry.getValue());
		}

		// We are done. Shutdown the broker. Wait forever (> 0 means wait that many milliseconds).
		broker.shutdown(0);
	}