.setPort(1883) .setHost("0.0.0.0");
.setPort(8883) .setPemKeyCertOptions(new PemKeyCertOptions() .setKeyPath("server-key.pem")
/** * Default constructor */ public MqttServerOptions() { super(); // override the default port this.setPort(DEFAULT_PORT); this.maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE; this.isAutoClientId = true; this.timeoutOnConnect = DEFAULT_TIMEOUT_ON_CONNECT; }
/** * Default constructor */ public MqttServerOptions() { super(); // override the default port this.setPort(DEFAULT_PORT); this.maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE; this.isAutoClientId = true; this.timeoutOnConnect = DEFAULT_TIMEOUT_ON_CONNECT; }
/** * Default constructor */ public MqttServerOptions() { super(); // override the default port this.setPort(DEFAULT_PORT); this.maxMessageSize = DEFAULT_MAX_MESSAGE_SIZE; this.isAutoClientId = true; }
@Bean @ConditionalOnMissingBean(MqttServerOptions.class) public MqttServerOptions mqttServerOptions() { return new MqttServerOptions() .setHost(properties.getHost()) .setPort(properties.getPort()); }
/** * Create an options from JSON * * @param json the JSON */ public MqttServerOptions(JsonObject json) { super(json); // override the default port this.setPort(json.getInteger("port", DEFAULT_PORT)); this.maxMessageSize = json.getInteger("maxMessageSize", DEFAULT_MAX_MESSAGE_SIZE); this.isAutoClientId = json.getBoolean("isAutoClientId", true); if ((this.maxMessageSize > 0) && (this.getReceiveBufferSize() > 0)) { Arguments.require(this.getReceiveBufferSize() >= this.maxMessageSize, "Receiver buffer size can't be lower than max message size"); } }
private Future<Void> bindInsecureMqttServer() { if (isInsecurePortEnabled()) { final MqttServerOptions options = new MqttServerOptions(); options .setHost(getConfig().getInsecurePortBindAddress()) .setPort(determineInsecurePort()) .setMaxMessageSize(getConfig().getMaxPayloadSize()); return bindMqttServer(options, insecureServer).map(server -> { insecureServer = server; return (Void) null; }).recover(t -> { return Future.failedFuture(t); }); } else { return Future.succeededFuture(); } }
private Future<Void> bindInsecureMqttServer() { if (isInsecurePortEnabled()) { final MqttServerOptions options = new MqttServerOptions(); options .setHost(getConfig().getInsecurePortBindAddress()) .setPort(determineInsecurePort()) .setMaxMessageSize(getConfig().getMaxPayloadSize()); return bindMqttServer(options, insecureServer).map(server -> { insecureServer = server; return (Void) null; }).recover(t -> { return Future.failedFuture(t); }); } else { return Future.succeededFuture(); } }
options.setHost(this.options.getBindAddress()).setPort(this.options.getListenPort()); options.setAutoClientId(true);
/** * Create an options from JSON * * @param json the JSON */ public MqttServerOptions(JsonObject json) { super(json); // override the default port this.setPort(json.getInteger("port", DEFAULT_PORT)); this.maxMessageSize = json.getInteger("maxMessageSize", DEFAULT_MAX_MESSAGE_SIZE); this.isAutoClientId = json.getBoolean("isAutoClientId", true); this.timeoutOnConnect = json.getInteger("timeoutOnConnect", DEFAULT_TIMEOUT_ON_CONNECT); if ((this.maxMessageSize > 0) && (this.getReceiveBufferSize() > 0)) { Arguments.require(this.getReceiveBufferSize() >= this.maxMessageSize, "Receiver buffer size can't be lower than max message size"); } }
/** * Create an options from JSON * * @param json the JSON */ public MqttServerOptions(JsonObject json) { super(json); // override the default port this.setPort(json.getInteger("port", DEFAULT_PORT)); this.maxMessageSize = json.getInteger("maxMessageSize", DEFAULT_MAX_MESSAGE_SIZE); this.isAutoClientId = json.getBoolean("isAutoClientId", true); this.timeoutOnConnect = json.getInteger("timeoutOnConnect", DEFAULT_TIMEOUT_ON_CONNECT); if ((this.maxMessageSize > 0) && (this.getReceiveBufferSize() > 0)) { Arguments.require(this.getReceiveBufferSize() >= this.maxMessageSize, "Receiver buffer size can't be lower than max message size"); } }
private Future<Void> bindSecureMqttServer() { if (isSecurePortEnabled()) { final MqttServerOptions options = new MqttServerOptions(); options .setHost(getConfig().getBindAddress()) .setPort(determineSecurePort()) .setMaxMessageSize(getConfig().getMaxPayloadSize()); addTlsKeyCertOptions(options); addTlsTrustOptions(options); return bindMqttServer(options, server).map(s -> { server = s; return (Void) null; }).recover(t -> { return Future.failedFuture(t); }); } else { return Future.succeededFuture(); } }
private Future<Void> bindSecureMqttServer() { if (isSecurePortEnabled()) { final MqttServerOptions options = new MqttServerOptions(); options .setHost(getConfig().getBindAddress()) .setPort(determineSecurePort()) .setMaxMessageSize(getConfig().getMaxPayloadSize()); addTlsKeyCertOptions(options); addTlsTrustOptions(options); return bindMqttServer(options, server).map(s -> { server = s; return (Void) null; }).recover(t -> { return Future.failedFuture(t); }); } else { return Future.succeededFuture(); } }
@Before public void before(TestContext context) { MqttServerOptions options = new MqttServerOptions() .setPort(MQTT_SERVER_TLS_PORT) .setKeyCertOptions(Cert.SERVER_PEM_ROOT_CA.get()) .setSsl(true); // just useful for enabling decryption using Wireshark (which doesn't support default Diffie-Hellmann for key exchange) // options.addEnabledCipherSuite("TLS_RSA_WITH_AES_256_CBC_SHA256"); this.setUp(context, options); }
@Before public void before(TestContext context) { MqttServerOptions options = new MqttServerOptions() .setPort(MQTT_SERVER_TLS_PORT) .setKeyCertOptions(Cert.SERVER_PEM_ROOT_CA.get()) .setSsl(true); // just useful for enabling decryption using Wireshark (which doesn't support default Diffie-Hellmann for key exchange) // options.addEnabledCipherSuite("TLS_RSA_WITH_AES_256_CBC_SHA256"); this.setUp(context, options); }
@Before public void before(TestContext context) { MqttServerOptions options = new MqttServerOptions() .setPort(MQTT_SERVER_TLS_PORT) .setKeyCertOptions(Cert.SERVER_PEM_ROOT_CA.get()) .setTrustOptions(Trust.SERVER_PEM_ROOT_CA.get()) .setSsl(true) .setClientAuth(ClientAuth.REQUEST); this.setUp(context, options); }
@Before public void before(TestContext context) { MqttServerOptions options = new MqttServerOptions() .setPort(MQTT_SERVER_TLS_PORT) .setKeyCertOptions(Cert.SERVER_PEM_ROOT_CA.get()) .setTrustOptions(Trust.SERVER_PEM_ROOT_CA.get()) .setSsl(true) .setClientAuth(ClientAuth.REQUEST); this.setUp(context, options); }
@Before public void before(TestContext ctx) { PemKeyCertOptions pemKeyCertOptions = new PemKeyCertOptions() .setKeyPath("tls/server-key.pem") .setCertPath("tls/server-cert.pem"); MqttServerOptions serverOptions = new MqttServerOptions() .setPort(MQTT_SERVER_TLS_PORT) .setHost(MQTT_SERVER_HOST) .setKeyCertOptions(pemKeyCertOptions) .setSsl(true); server = MqttServer.create(vertx, serverOptions); server.exceptionHandler(t -> context.assertTrue(false)); server.endpointHandler(e -> { log.info("Client connected"); e.disconnectHandler(d -> log.info("Client disconnected")); e.accept(false); }).listen(ctx.asyncAssertSuccess()); }
@Before public void before(TestContext ctx) { PemKeyCertOptions pemKeyCertOptions = new PemKeyCertOptions() .setKeyPath("tls/server-key.pem") .setCertPath("tls/server-cert.pem"); MqttServerOptions serverOptions = new MqttServerOptions() .setPort(MQTT_SERVER_TLS_PORT) .setHost(MQTT_SERVER_HOST) .setKeyCertOptions(pemKeyCertOptions) .setSsl(true); server = MqttServer.create(vertx, serverOptions); server.exceptionHandler(t -> context.assertTrue(false)); server.endpointHandler(e -> { log.info("Client connected"); e.disconnectHandler(d -> log.info("Client disconnected")); e.accept(false); }).listen(ctx.asyncAssertSuccess()); }