software/mosquitto/test: fix flaky test

This test is using two connection one with a client to subscribe to a
topic and wait for message and another one with publish.single to
publish to the topic.
The test was failing from time to time because the publish might have
happened after the client was subscribed.

Refactor the test to use `loop` on the client to have more control
and be able to wait for the client to be subscribed using the
`on_subscribe` callback.

The test is also factorized, instead of having the same test twice for
IPv4 and IPv6, we pass the host as parameter.
7 jobs for fix/mosquitto-test in 0 seconds
Status Job ID Name Coverage
  External
passed Cloudooo.UnitTest-Master

00:14:43

passed ERP5.StandaloneDeploymentScriptTest-Debian.Buster

00:49:01

passed SlapOS.Eggs.UnitTest-Master.Python2

00:27:40

failed SlapOS.Eggs.UnitTest-Master.Python3

00:24:35

passed SlapOS.Eggs.UnitTest-Master.Python3Next

00:24:53

passed Wendelin.StandaloneDeploymentScriptTest-Debian.Buster

00:37:48

passed Wendelin.StandaloneDeploymentScriptTest-Debian.Buster

00:50:42