use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.
the class AmqpServiceBase method createInsecureServerOptions.
/**
* Invoked during start up to create options for the proton server instance binding to the insecure port.
* <p>
* Subclasses may override this method to set custom options.
*
* @return The options.
*/
protected ProtonServerOptions createInsecureServerOptions() {
ProtonServerOptions options = new ProtonServerOptions();
// // close idle connections after two minutes of inactivity
options.setHeartbeat(60000);
// 16kb
options.setReceiveBufferSize(16 * 1024);
// 16kb
options.setSendBufferSize(16 * 1024);
options.setLogActivity(getConfig().isNetworkDebugLoggingEnabled());
return options;
}
use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.
the class AmqpServiceBase method createServerOptions.
/**
* Invoked during start up to create options for the proton server instance binding to the secure port.
* <p>
* Subclasses may override this method to set custom options.
*
* @return The options.
*/
protected ProtonServerOptions createServerOptions() {
ProtonServerOptions options = createInsecureServerOptions();
addTlsKeyCertOptions(options);
addTlsTrustOptions(options);
return options;
}
use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.
the class AmqpServiceBase method startSecureServer.
private Future<Void> startSecureServer() {
if (isSecurePortEnabled()) {
int securePort = determineSecurePort();
final Future<Void> result = Future.future();
final ProtonServerOptions options = createServerOptions();
server = createProtonServer(options).connectHandler(this::onRemoteConnectionOpen).listen(securePort, getConfig().getBindAddress(), bindAttempt -> {
if (bindAttempt.succeeded()) {
if (getPort() == getPortDefaultValue()) {
LOG.info("server listens on standard secure port [{}:{}]", getBindAddress(), getPort());
} else {
LOG.warn("server listens on non-standard secure port [{}:{}], default is {}", getBindAddress(), getPort(), getPortDefaultValue());
}
result.complete();
} else {
LOG.error("cannot bind to secure port", bindAttempt.cause());
result.fail(bindAttempt.cause());
}
});
return result;
} else {
LOG.info("secure port is not enabled");
return Future.succeededFuture();
}
}
use of io.vertx.proton.ProtonServerOptions in project hono by eclipse.
the class AmqpServiceBase method startInsecureServer.
private Future<Void> startInsecureServer() {
if (isInsecurePortEnabled()) {
int insecurePort = determineInsecurePort();
final Future<Void> result = Future.future();
final ProtonServerOptions options = createInsecureServerOptions();
insecureServer = createProtonServer(options).connectHandler(this::onRemoteConnectionOpenInsecurePort).listen(insecurePort, getConfig().getInsecurePortBindAddress(), bindAttempt -> {
if (bindAttempt.succeeded()) {
if (getInsecurePort() == getInsecurePortDefaultValue()) {
LOG.info("server listens on standard insecure port [{}:{}]", getInsecurePortBindAddress(), getInsecurePort());
} else {
LOG.warn("server listens on non-standard insecure port [{}:{}], default is {}", getInsecurePortBindAddress(), getInsecurePort(), getInsecurePortDefaultValue());
}
result.complete();
} else {
LOG.error("cannot bind to insecure port", bindAttempt.cause());
result.fail(bindAttempt.cause());
}
});
return result;
} else {
LOG.info("insecure port is not enabled");
return Future.succeededFuture();
}
}
Aggregations