Merge pull request #54 from veebs/WebSocketSSL

Added checks to make sure expected system properties are present for WebSocket SSL example
This commit is contained in:
Vibul Imtarnasan 2011-11-12 19:57:42 -08:00
commit 1e0dee3e9b

View File

@ -59,6 +59,18 @@ public class WebSocketSslServer {
Logger.getLogger("").addHandler(ch); Logger.getLogger("").addHandler(ch);
Logger.getLogger("").setLevel(Level.FINE); Logger.getLogger("").setLevel(Level.FINE);
String keyStoreFilePath = System.getProperty("keystore.file.path");
if (keyStoreFilePath == null || keyStoreFilePath.isEmpty()) {
System.out.println("ERROR: System property keystore.file.path not set. Exiting now!");
System.exit(1);
}
String keyStoreFilePassword = System.getProperty("keystore.file.password");
if (keyStoreFilePassword == null || keyStoreFilePassword.isEmpty()) {
System.out.println("ERROR: System property keystore.file.password not set. Exiting now!");
System.exit(1);
}
// Configure the server. // Configure the server.
ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory( ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(
Executors.newCachedThreadPool(), Executors.newCachedThreadPool())); Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));