Package com.sun.grizzly

Examples of com.sun.grizzly.SSLConfig


    @Test(timeOut = 20000)
    public void testSSLStartup() throws Exception{
        logger.info("Running testSSLStartup");

        SSLConfig cfg = new SSLConfig();
        ClassLoader cl = getClass().getClassLoader();
        URL keystoreUrl = cl.getResource("ssltest-keystore.jks");
        String keyStoreFile = new File(keystoreUrl.toURI()).getAbsolutePath();
        cfg.setKeyStoreFile(keyStoreFile);
        cfg.setKeyPass("changeit");

        URL cacertsUrl = cl.getResource("ssltest-cacerts.jks");
        String trustStoreFile = new File(cacertsUrl.toURI()).getAbsolutePath();
        cfg.setTrustStoreFile(trustStoreFile);
        cfg.setTrustStorePass("changeit");

        AtmosphereSpadeServer sslSpade = AtmosphereSpadeServer.build("https://127.0.0.1:" + 7777 + "/",
                PubSubTest.class.getPackage().getName(), cfg );
        sslSpade.start();
    }
View Full Code Here


       if (useSSL) {
           System.out.println("Starting SSL ...");
           String jks = cfg.getJKS("keys/rest.jks");
           String jksPassword = cfg.getJKSPassword();

           SSLConfig sslConfig = new SSLConfig();
           URL resource = getClass().getClassLoader().getResource(jks);
           if (resource == null) {
               LOG.error("Unable to find the keystore file: " + jks);
               System.exit(2);
           }
           try {
               sslConfig.setKeyStoreFile(new File(resource.toURI())
                       .getAbsolutePath());
           } catch (URISyntaxException e1) {
               LOG.error("Unable to load keystore: " + jks, e1);
               System.exit(2);
           }
           sslConfig.setKeyStorePass(jksPassword);
           gws.setSSLConfig(sslConfig);
       }

       gws.start();
   }
View Full Code Here

    protected void startServer(String keystorePath) throws Exception {

        webServer = new GrizzlyWebServer(getPort(), ".", true);

        SSLConfig sslConfig = new SSLConfig();

        URL resource = Resources.getResource(keystorePath);

        if (resource != null) {
            String path = new File(resource.toURI()).getAbsolutePath();
            sslConfig.setKeyStoreFile(path);
            sslConfig.setKeyStorePass("testpass");
        } else {
            throw new RuntimeException("Failed to find test keystore");
        }
        webServer.setSSLConfig(sslConfig);
View Full Code Here

TOP

Related Classes of com.sun.grizzly.SSLConfig

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.