use of org.neo4j.server.helpers.CommunityWebContainerBuilder in project neo4j by neo4j.
the class HttpsAccessIT method startServer.
private void startServer(boolean httpEnabled, boolean httpsEnabled) throws Exception {
CommunityWebContainerBuilder serverBuilder = serverOnRandomPorts().usingDataDir(folder.directory(name.getMethodName()).toAbsolutePath().toString());
if (!httpEnabled) {
serverBuilder.withHttpDisabled();
}
if (httpsEnabled) {
serverBuilder.withHttpsEnabled();
}
testWebContainer = serverBuilder.build();
// Because we are generating a non-CA-signed certificate, we need to turn off verification in the client.
// This is ironic, since there is no proper verification on the CA side in the first place, but I digress.
TrustManager[] trustAllCerts = { new InsecureTrustManager() };
// Install the all-trusting trust manager
SSLContext sc = SSLContext.getInstance("TLS");
sc.init(null, trustAllCerts, new SecureRandom());
HttpsURLConnection.setDefaultSSLSocketFactory(sc.getSocketFactory());
}
Aggregations