Fix Issue #193

Fix https://github.com/adamvr/MQTT.js/issues/193

Unit testing with sinon.