System.out.println("MQTT server started and listening on port " + server.actualPort()); } else { System.err.println("MQTT server error on start" + ar.cause().getMessage());
System.out.println("MQTT server is listening on port " + mqttServer.actualPort()); } else { System.err.println("Error on starting the server" + ar.cause().getMessage());
System.out.println("MQTT server is listening on port " + mqttServer.actualPort()); } else { System.err.println("Error on starting the server" + ar.cause().getMessage());
/** * The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number * signifying an ephemeral port * @return the actual port the server is listening on. */ public int actualPort() { int ret = delegate.actualPort(); return ret; }
@Override protected final int getActualPort() { return server != null ? server.actualPort() : Constants.PORT_UNCONFIGURED; }
/** * The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number * signifying an ephemeral port * @return the actual port the server is listening on. */ public int actualPort() { int ret = delegate.actualPort(); return ret; }
/** * The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number * signifying an ephemeral port * @return the actual port the server is listening on. */ public int actualPort() { int ret = delegate.actualPort(); return ret; }
@Override protected final int getActualPort() { return server != null ? server.actualPort() : Constants.PORT_UNCONFIGURED; }
@Override protected final int getActualInsecurePort() { return insecureServer != null ? insecureServer.actualPort() : Constants.PORT_UNCONFIGURED; }
@Override protected final int getActualInsecurePort() { return insecureServer != null ? insecureServer.actualPort() : Constants.PORT_UNCONFIGURED; }
/** * Sets the MQTT server to use for handling secure MQTT connections. * * @param server The server. * @throws NullPointerException if the server is {@code null}. */ public void setMqttSecureServer(final MqttServer server) { Objects.requireNonNull(server); if (server.actualPort() > 0) { throw new IllegalArgumentException("MQTT server must not be started already"); } else { this.server = server; } }
/** * Sets the MQTT server to use for handling non-secure MQTT connections. * * @param server The server. * @throws NullPointerException if the server is {@code null}. */ public void setMqttInsecureServer(final MqttServer server) { Objects.requireNonNull(server); if (server.actualPort() > 0) { throw new IllegalArgumentException("MQTT server must not be started already"); } else { this.insecureServer = server; } }
/** * Sets the MQTT server to use for handling secure MQTT connections. * * @param server The server. * @throws NullPointerException if the server is {@code null}. */ public void setMqttSecureServer(final MqttServer server) { Objects.requireNonNull(server); if (server.actualPort() > 0) { throw new IllegalArgumentException("MQTT server must not be started already"); } else { this.server = server; } }
/** * Sets the MQTT server to use for handling non-secure MQTT connections. * * @param server The server. * @throws NullPointerException if the server is {@code null}. */ public void setMqttInsecureServer(final MqttServer server) { Objects.requireNonNull(server); if (server.actualPort() > 0) { throw new IllegalArgumentException("MQTT server must not be started already"); } else { this.insecureServer = server; } }
private Future<MqttServer> bindMqttServer(final MqttServerOptions options, final MqttServer mqttServer) { final Future<MqttServer> result = Future.future(); final MqttServer createdMqttServer = mqttServer == null ? MqttServer.create(this.vertx, options) : mqttServer; createdMqttServer .endpointHandler(this::handleEndpointConnection) .listen(done -> { if (done.succeeded()) { LOG.info("MQTT server running on {}:{}", getConfig().getBindAddress(), createdMqttServer.actualPort()); result.complete(createdMqttServer); } else { LOG.error("error while starting up MQTT server", done.cause()); result.fail(done.cause()); } }); return result; }
private Future<MqttServer> bindMqttServer(final MqttServerOptions options, final MqttServer mqttServer) { final Future<MqttServer> result = Future.future(); final MqttServer createdMqttServer = mqttServer == null ? MqttServer.create(this.vertx, options) : mqttServer; createdMqttServer .endpointHandler(this::handleEndpointConnection) .listen(done -> { if (done.succeeded()) { LOG.info("MQTT server running on {}:{}", getConfig().getBindAddress(), createdMqttServer.actualPort()); result.complete(createdMqttServer); } else { LOG.error("error while starting up MQTT server", done.cause()); result.fail(done.cause()); } }); return result; }
LOG.info("MQTT gateway running on {}:{}", this.options.getBindAddress(), this.server.actualPort()); LOG.info("AMQP messaging service on {}:{}", this.options.getMessagingServiceHost(), this.options.getMessagingServicePort()); startFuture.complete();
log.info("MQTT server listening on port " + ar.result().actualPort()); latchListen.countDown(); } else {
/** * Setup the needs for starting the MQTT server * * @param context TestContext instance * @param options MQTT server options */ protected void setUp(TestContext context, MqttServerOptions options) { this.vertx = Vertx.vertx(); if (options == null) { this.mqttServer = MqttServer.create(this.vertx); } else { this.mqttServer = MqttServer.create(this.vertx, options); } this.mqttServer.exceptionHandler(err -> { rejection = err; }); Async async = context.async(); this.mqttServer.endpointHandler(endpoint -> endpointHandler(endpoint, context)).listen(context.asyncAssertSuccess(res -> { log.info("MQTT server listening on port " + res.actualPort()); async.complete(); })); // Synchronous start since the proxy might be triggered in method overrides async.awaitSuccess(15000); }
/** * Setup the needs for starting the MQTT server * * @param context TestContext instance * @param options MQTT server options */ protected void setUp(TestContext context, MqttServerOptions options) { this.vertx = Vertx.vertx(); if (options == null) { this.mqttServer = MqttServer.create(this.vertx); } else { this.mqttServer = MqttServer.create(this.vertx, options); } this.mqttServer.exceptionHandler(err -> { rejection = err; }); Async async = context.async(); this.mqttServer.endpointHandler(endpoint -> endpointHandler(endpoint, context)).listen(context.asyncAssertSuccess(res -> { log.info("MQTT server listening on port " + res.actualPort()); async.complete(); })); // Synchronous start since the proxy might be triggered in method overrides async.awaitSuccess(15000); }