@Test
public void testSource() {

    String topic = UUID.randomUUID().toString();
    Map<String, Object> config = new HashMap<>();
    config.put("topic", topic);
    config.put("host", address);
    config.put("port", port);
    config.put("channel-name", topic);
    MqttSource source = new MqttSource(vertx, new MqttConnectorIncomingConfiguration(new MapBasedConfig(config)));
    List<MqttMessage<?>> messages = new ArrayList<>();
    PublisherBuilder<MqttMessage<?>> stream = source.getSource();
    stream.forEach(messages::add).run();
    await().until(source::isSubscribed);
    AtomicInteger counter = new AtomicInteger();
    new Thread(() -> usage.produceIntegers(topic, 10, null,
            counter::getAndIncrement)).start();
    await().atMost(2, TimeUnit.MINUTES).until(() -> messages.size() >= 10);
    assertThat(messages.stream()
            .map(Message::getPayload)
            .map(x -> (byte[]) x)
            .map(bytes -> Integer.valueOf(new String(bytes)))
            .collect(Collectors.toList()))
                    .containsExactly(0, 1, 2, 3, 4, 5, 6, 7, 8, 9);
}