import javax.net.*; import javax.net.ssl.*; static L serveHttpsWithWebsockets_multiplePorts_servers = synchroList(); // factory: func(NanoHTTPD.IHTTPSession) -> WebSocket static void serveHttpsWithWebsockets_multiplePorts(File keystore, S pass, O factory, int... ports) ctex { for (int port : ports) { WebSocketHTTPD httpd = new WebSocketHTTPD(port, factory); httpd.makeSecure(makeSSLServerSocketFactory(keystore, pass)); serveHttpsWithWebsockets_multiplePorts_servers.add(httpd); httpd.start(); } } // factory: func(NanoHTTPD.IHTTPSession) -> WebSocket static void serveHttpsWithWebsockets_multiplePorts(SSLServerSocketFactory socketFactory, O factory, int... ports) ctex { for (int port : ports) { WebSocketHTTPD httpd = new WebSocketHTTPD(port, factory); httpd.makeSecure(socketFactory); serveHttpsWithWebsockets_multiplePorts_servers.add(httpd); httpd.start(); } } static void cleanMeUp_serveHttpsWithWebsockets_multiplePorts() { for (WebSocketHTTPD httpd : cloneList(serveHttpsWithWebsockets_multiplePorts_servers)) { pcall { httpd.stop(); } serveHttpsWithWebsockets_multiplePorts_servers.remove(httpd); } }