boolean serverCert, boolean serverTrust,
boolean requireClientAuth, boolean clientTrustAll,
boolean shouldPass, boolean startTLS,
String... enabledCipherSuites) throws Exception {
server.close();
NetServerOptions options = new NetServerOptions();
if (!startTLS) {
options.setSsl(true);
}
if (serverTrust) {
options.setTrustStoreOptions(new JKSOptions().setPath(findFileOnClasspath("tls/server-truststore.jks")).setPassword("wibble"));
}
if (serverCert) {
options.setKeyStoreOptions(new JKSOptions().setPath(findFileOnClasspath("tls/server-keystore.jks")).setPassword("wibble"));
}
if (requireClientAuth) {
options.setClientAuthRequired(true);
}
for (String suite: enabledCipherSuites) {
options.addEnabledCipherSuite(suite);
}
options.setPort(4043);
server = vertx.createNetServer(options);
Handler<NetSocket> serverHandler = socket -> {
AtomicBoolean upgradedServer = new AtomicBoolean();
socket.handler(buff -> {
socket.write(buff); // echo the data