Exemplo n.º 1
0
 protected static MQTT mqttClient(String host, int port) {
   MQTT client = new MQTT();
   client.setCleanSession(true);
   client.setClientId("amc-" + Thread.currentThread().getId() + "-" + System.currentTimeMillis());
   client.setHost(URIs.newURI("tcp://" + host + ":" + port));
   return client;
 }
 @Test
 public void canInstantiateLinkWithDependentAttributes() {
   LinkManager connectionManager = LinkManager.getInstance();
   Link link =
       connectionManager
           .getConfigurer(
               URIs.newURI("ardulink://dependendAttributes?devicePort=foo&host=h&port=1"))
           .newLink();
   assertThat(link, is(notNullValue()));
 }
Exemplo n.º 3
0
 private MQTT newClient(MqttLinkConfig config) {
   MQTT client = new MQTT();
   client.setClientId(config.getClientId());
   client.setHost(URIs.newURI("tcp://" + config.getHost() + ":" + config.getPort()));
   return client;
 }