use of io.vertx.core.net.SelfSignedCertificate in project hono by eclipse.
the class TenantServiceBasedX509AuthenticationTest method createClientCertificate.
@BeforeAll
static void createClientCertificate() throws GeneralSecurityException, IOException {
final SelfSignedCertificate ssc = SelfSignedCertificate.create("eclipse.org");
final CertificateFactory factory = CertificateFactory.getInstance("X.509");
cert = (X509Certificate) factory.generateCertificate(new FileInputStream(ssc.certificatePath()));
certPath = new Certificate[] { cert };
}
use of io.vertx.core.net.SelfSignedCertificate in project vertx-examples by vert-x3.
the class Server method start.
@Override
public void start() throws Exception {
SelfSignedCertificate certificate = SelfSignedCertificate.create();
HttpServerOptions serverOptions = new HttpServerOptions().setSsl(true).setKeyCertOptions(certificate.keyCertOptions());
vertx.createHttpServer(serverOptions).requestHandler(req -> {
System.out.println("Got request " + req.uri());
for (String name : req.headers().names()) {
System.out.println(name + ": " + req.headers().get(name));
}
req.handler(data -> System.out.println("Got data " + data.toString("ISO-8859-1")));
req.endHandler(v -> {
// Now send back a response
req.response().setChunked(true);
for (int i = 0; i < 10; i++) {
req.response().write("server-data-chunk-" + i);
}
req.response().end();
});
}).listen(8282);
}
Aggregations