/** * Set an exception handler for the client, that will be called when an error happens * in internal netty structures. * * <code>io.netty.handler.codec.DecoderException</code> can be one of the cause * @param handler the exception handler * @return current MQTT client instance */ public io.vertx.rxjava.mqtt.MqttClient exceptionHandler(Handler<Throwable> handler) { delegate.exceptionHandler(handler); return this; }
/** * Set an exception handler for the client, that will be called when an error happens * in internal netty structures. * * <code>io.netty.handler.codec.DecoderException</code> can be one of the cause * @param handler the exception handler * @return current MQTT client instance */ public io.vertx.rxjava.mqtt.MqttClient exceptionHandler(Handler<Throwable> handler) { delegate.exceptionHandler(handler); return this; }
@Test public void clientSslTrustAllTest(TestContext context) { MqttClientOptions clientOptions = new MqttClientOptions() .setSsl(true) .setTrustAll(true); MqttClient client = MqttClient.create(vertx, clientOptions); client.exceptionHandler(t -> context.assertTrue(false)); this.context = context; Async async = context.async(); client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown())); async.await(); }
@Test public void clientSslTrustAllTest(TestContext context) { MqttClientOptions clientOptions = new MqttClientOptions() .setSsl(true) .setTrustAll(true); MqttClient client = MqttClient.create(vertx, clientOptions); client.exceptionHandler(t -> context.assertTrue(false)); this.context = context; Async async = context.async(); client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown())); async.await(); }
}); client.exceptionHandler(t->{ log.error("Exception raised", t);
}); client.exceptionHandler(t->{ log.error("Exception raised", t);
@Test public void clientSslClientTruststoreTest(TestContext context) { this.context = context; JksOptions jksOptions = new JksOptions().setPath("/tls/client-truststore.jks"); MqttClientOptions clientOptions = new MqttClientOptions() .setSsl(true) .setTrustStoreOptions(jksOptions); MqttClient client = MqttClient.create(vertx, clientOptions); client.exceptionHandler(t -> context.assertTrue(false)); Async async = context.async(); client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown())); async.await(); }
@Test public void clientSslClientTruststoreTest(TestContext context) { this.context = context; JksOptions jksOptions = new JksOptions().setPath("/tls/client-truststore.jks"); MqttClientOptions clientOptions = new MqttClientOptions() .setSsl(true) .setTrustStoreOptions(jksOptions); MqttClient client = MqttClient.create(vertx, clientOptions); client.exceptionHandler(t -> context.assertTrue(false)); Async async = context.async(); client.connect(MQTT_SERVER_TLS_PORT, MQTT_SERVER_HOST, s -> client.disconnect(d -> async.countDown())); async.await(); }