users@grizzly.java.net

Re: SSL Layer

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Thu, 13 Aug 2009 17:06:19 +0200

Hi,

it's difficult to say from the code.
Can you pls. share client and server code to reproduce the issue?

Thanks.

WBR,
Alexey.

On Aug 13, 2009, at 16:49 , Alaska wrote:

>
> Hello,
>
> I"m implementing a SSL Layer and I got this error message:
>
> com.sun.grizzly.Controller start
> INFO: Starting Grizzly Framework 1.9.17-SNAPSHOT
> com.sun.grizzly.DefaultCallbackHandler onConnect
> SEVERE: Connection refused
> com.sun.grizzly.Controller start
> INFO: Starting Grizzly Framework 1.9.17-SNAPSHOT
>
> Do you know what is going wrong?
>
> Thank you,
> alaska
>
> ++++++++++++++++++++++++++++++++
> The SSL Layer looks like:
>
>
> public void setUp() {
> sslConfig = new SSLConfig();
>
> URL cacertsUrl =
> getClass().getClassLoader().getResource("ssltest-cacert.jks");
>
> if (cacertsUrl != null) {
> sslConfig.setTrustStoreFile(cacertsUrl.getFile());
> System.out.println("truststore file has been set");
>
> } else {
> System.out.println("Couldn't find the truststore file");
>
> }
>
>
>
> //he keystore will be used for encrypting/signing some thing
> with
> your private key
> URL keystoreUrl =
> getClass().getClassLoader().getResource("ssltest-keystore.jks");
> if (keystoreUrl != null) {
> sslConfig.setKeyStoreFile(keystoreUrl.getFile());
> System.out.println("keystoreUrl file has been set");
>
> } else {
> System.out.println("Couldn't find the keystore");
>
> }
> SSLConfig.DEFAULT_CONFIG = sslConfig;
> final Controller controller =
> createSSLController(SSLConfig.DEFAULT_CONFIG.createSSLContext());
> try {
> controller.start();
> } catch (IOException ex) {
>
> Logger
> .getLogger(SSLConnectionTest.class.getName()).log(Level.SEVERE, "the
> SSL controller couldn't not been started", ex);
> }
> }
>
>
>
>
> private Controller createSSLController(SSLContext sslContext) {
> System.out.println("readfilter");
>
> final SSLReadFilter readFilter = new SSLReadFilter();
> readFilter.setSSLContext(sslContext);
>
> final ProtocolFilter asciiCommandParser = new
> AsciiCommandProtocolParserFilter();
>
> final ProtocolFilter genericProtocolFilter = new
> RequestControllerFilter();
>
> final ProtocolFilter genericDoor = new GenericDoor();
>
> SSLSelectorHandler selectorHandler = new SSLSelectorHandler();
> selectorHandler.setPort(PORT);
>
> final Controller controller = new Controller();
>
> controller.setSelectorHandler(selectorHandler);
> controller.setHandleReadWriteConcurrently(false);
>
> final SSLConnectorHandler sslConnector = new
> SSLConnectorHandler();
> try {
> sslConnector.connect(new InetSocketAddress("localhost",
> PORT));
> } catch (IOException ex) {
>
> Logger.getLogger(SSLConnectionTest.class.getName()).log(Level.SEVERE,
> "cannot connect", ex);
> }
>
> controller.setProtocolChainInstanceHandler(new
> DefaultProtocolChainInstanceHandler() {
>
> @Override
> public ProtocolChain poll() {
> ProtocolChain protocolChain = protocolChains.poll();
> if (protocolChain == null) {
> protocolChain = new DefaultProtocolChain();
> System.out.println("readfilter");
> protocolChain.addFilter(readFilter);
> System.out.println("asciiCommandParser");
> protocolChain.addFilter(parser);
> protocolChain.addFilter(HttpFilter);
> protocolChain.addFilter(processRequestFilter);
>
> }
> return protocolChain;
> }
> });
>
> return controller;
> }
>
> --
> View this message in context: http://www.nabble.com/SSL-Layer-tp24954939p24954939.html
> Sent from the Grizzly - Users mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>