refactors MqttClient creation and tests

* introduces a client factory to avoid global state which prevents
  efficient testability
0.15.3