made distribution function mockable

* server has a 'if __name__ == '__main__' like check that makes
  it either run/listen automatically or export itself as module.
initial test

* tests client.on('publish' using a mocked distribute function
* tests on port 1884