}
}
public static ManagementHttpServer create(InetSocketAddress bindAddress, InetSocketAddress secureBindAddress, int backlog, ModelControllerClient modelControllerClient, Executor executor, SecurityRealm securityRealm)
throws IOException {
HttpServer httpServer = null;
if (bindAddress != null) {
httpServer = HttpServer.create(bindAddress, backlog);
httpServer.setExecutor(executor);
}
HttpServer secureHttpServer = null;
if (secureBindAddress != null) {
secureHttpServer = HttpsServer.create(secureBindAddress, backlog);
SSLContext context = securityRealm.getSSLContext();
((HttpsServer) secureHttpServer).setHttpsConfigurator(new HttpsConfigurator(context) {
@Override
public void configure(HttpsParameters params) {
super.configure(params);
{
if (true)
return;
// TODO - Add propper capture of these values.
System.out.println(" * SSLContext * ");
SSLContext sslContext = getSSLContext();
SSLParameters sslParams = sslContext.getDefaultSSLParameters();
String[] cipherSuites = sslParams.getCipherSuites();
for (String current : cipherSuites) {
System.out.println("Cipher Suite - " + current);
}
System.out.println("Need Client Auth " + sslParams.getNeedClientAuth());
String[] protocols = sslParams.getProtocols();
for (String current : protocols) {
System.out.println("Protocol " + current);
}
System.out.println("Want Client Auth " + sslParams.getWantClientAuth());
}
System.out.println(" * HTTPSParameters * ");
{
System.out.println("Client Address " + params.getClientAddress());
String[] cipherSuites = params.getCipherSuites();
if (cipherSuites != null) {
for (String current : cipherSuites) {
System.out.println("Cipher Suite - " + current);
}
}
System.out.println("Need Client Auth " + params.getNeedClientAuth());
String[] protocols = params.getProtocols();
if (protocols != null) {
for (String current : protocols) {
System.out.println("Protocol " + current);
}
}
System.out.println("Want Client Auth " + params.getWantClientAuth());
}
}
});
secureHttpServer.setExecutor(executor);
}
ManagementHttpServer managementHttpServer = new ManagementHttpServer(httpServer, secureHttpServer, securityRealm);
managementHttpServer.addHandler(new DomainApiHandler(modelControllerClient));
managementHttpServer.addHandler(new ConsoleHandler());