users@grizzly.java.net

Re: Grizzly WebSocket SSL

From: Victor Antonio Barzana <viticoinf_at_gmail.com>
Date: Fri, 20 Dec 2013 08:31:15 +0200

Thanks Oleksiy for your quickly response, here is my code of how I am
creating my server:

// Create encrypted (SSL) server socket for wss:// protocol
if (mGrizzlySSLPort > 0) {
if (mLog.isDebugEnabled()) {
mLog.debug("Trying to initiate SSL on port " + mGrizzlySSLPort + "...");
}
if (mKeyStore != null && !mKeyStore.isEmpty()
&& mKeyStorePassword != null && !mKeyStorePassword.isEmpty()) {
if (mLog.isDebugEnabled()) {
mLog.debug("Using keystore " + mKeyStore + "...");
mLog.debug("Starting Grizzly SSL engine '"
+ getId()
+ "' at port " + mGrizzlySSLPort + ","
+ " with default timeout "
+ (mSessionTimeout > 0 ? mSessionTimeout + "ms" : "infinite")
+ "...");
}
try {
mGrizzlySSLServer = HttpServer.createSimpleServer(lDocumentRoot,
mGrizzlySSLPort);
SSLContextConfigurator sslContext = new SSLContextConfigurator();
sslContext.setKeyStoreFile(lKeyStorePath);
sslContext.setKeyStorePass(mKeyStorePassword);
SSLEngineConfigurator lEngineConfigurator = new
SSLEngineConfigurator(sslContext, false, false, false);
mGrizzlySSLServer.getListener("grizzly").setSSLEngineConfig(lEngineConfigurator);
mGrizzlySSLServer.getListener("grizzly").registerAddOn(new
WebSocketAddOn());

// The WebSocketApplication will control the incoming and
//outgoing flow, connection, listeners, etc...
final WebSocketApplication lGrizzlyApplication = new
GrizzlyWebSocketApplication(this);
// Registering grizzly jWebSocket Wrapper Application into grizzly
WebSocketEngine
WebSocketEngine.getEngine().register("/jWebSocket", "/jWebSocket",
lGrizzlyApplication);
mGrizzlySSLServer.start();
} catch (IOException lEx) {
mLog.error(Logging.getSimpleExceptionMessage(lEx, "instantiating SSL
engine"));
}
} else {
mLog.error("SSL engine could not be instantiated due to missing
configuration,"
+ " please set sslport, keystore and password options.");
}
}

When I try to connect from any browser client the response doesn't even
arrive to my grizzly listeners inside the websocket application, what could
be happening?

Thanks a lot, by the way, grizzly is a super good product, I am member of
the jWebSocket team and we have one of our WebSocket engines based in
Grizzly, very fast and reliable, as well scalable. My best regards to you
guys.

Thanks,
Victor