refactor the code to make it easy to support non-local brokers such as for connecting via JMX to a remote broker