users@grizzly.java.net

Creating SSLSelectorThread with Grizzly 1.0

From: Igor Minar <iiminar_at_gmail.com>
Date: Wed, 9 Dec 2009 10:47:02 -0800

Hi there,

I'm having a hard time creating an ssl selector with grizzly 1.0.31.
Here is my code:

KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
keyStore.load(new FileInputStream(new File(getKeystorePath())),
getKeystorePass().toCharArray());

TrustManagerFactory tmf =
TrustManagerFactory
.getInstance(TrustManagerFactory.getDefaultAlgorithm());
tmf.init(keyStore);
SSLContext sslContext = SSLContext.getInstance("TLS");
sslContext.init(null, tmf.getTrustManagers(), null);

grizzlySelector = new SSLSelectorThread();
SSLSelectorThread sslSelector = (SSLSelectorThread) grizzlySelector;
sslSelector.setSSLContext(sslContext);

//
sslSelector
.setEnabledCipherSuites
(sslContext.createSSLEngine().getEnabledCipherSuites()); //doesn't help
sslSelector.setSSLImplementation(new JSSEImplementation());


When I make a https connection to this selector with an
HttpsUrlConnection, I see the same Exception as captured here:

http://markmail.org/message/a6ef4zspdfymebnj#query:related
%3Aa6ef4zspdfymebnj+page:1+mid:a6ef4zspdfymebnj+state:results

I read that discussion thread and in my case I'm providing the correct
path to the keystore.

Interestingly only a very slightly modified code (due to api changes)
with unmodified client code works well with grizzly 1.9.

Does anyone have an idea what I'm doing wrong?

thanks,
Igor