Examples of SslContextFactory


Examples of org.eclipse.jetty.util.ssl.SslContextFactory

      server2.setHandler(server2Handler);

      SslSelectChannelConnector ssl_connector = new SslSelectChannelConnector();
      ssl_connector.setPort(testPort + 1);
      ssl_connector.setMaxIdleTime(30000);
      SslContextFactory ssl = ssl_connector.getSslContextFactory();
      ssl.setKeyStorePath("src/test/resources/test.jks");
      ssl.setKeyStorePassword("jclouds");
      ssl.setTrustStore("src/test/resources/test.jks");
      ssl.setTrustStorePassword("jclouds");

      server2.setConnectors(new Connector[] { ssl_connector });

      server2.start();
   }
View Full Code Here

Examples of org.eclipse.jetty.util.ssl.SslContextFactory

            String keyStorePath = this.getFile().getParent() + "/data/" + keystoreFile;
            try {
                ks = KeyStore.getInstance(keystoreType);
                ks.load(new FileInputStream(keyStorePath), keystorePassword.toCharArray());

                SslContextFactory sslContextFactory = new SslContextFactory();
                sslContextFactory.setKeyStore(ks);
                sslContextFactory.setKeyStorePassword(keystorePassword);
                sslContextFactory.setKeyStoreType(keystoreType);

                SslSocketConnector SSLConnector = new SslSocketConnector(sslContextFactory);
               
                SSLConnector.setPort(sslPort);
                SSLConnector.setMaxIdleTime(30000);
View Full Code Here

Examples of org.restlet.ext.ssl.SslContextFactory

    /** Starts the Restlet. */
    @Override
    public void start() throws Exception {
        // Initialize the SSL context
        SslContextFactory sslContextFactory = SslUtils
                .getSslContextFactory(this);
        SSLContext sslContext = sslContextFactory.createSslContext();
        String addr = getHelped().getAddress();

        if (addr != null) {
            // This call may throw UnknownHostException and otherwise always
            // returns an instance of INetAddress.
View Full Code Here

Examples of org.restlet.ext.ssl.SslContextFactory

     *            The helper to use.
     *
     * @return The SSL context factory.
     */
    public static SslContextFactory getSslContextFactory(RestletHelper<?> helper) {
        SslContextFactory result = (SslContextFactory) ((helper.getContext() == null) ? null
                : helper.getContext().getAttributes().get("sslContextFactory"));

        if (result == null) {
            String[] sslContextFactoryNames = helper.getHelpedParameters()
                    .getValuesArray("sslContextFactory");

            if (sslContextFactoryNames != null) {
                for (String sslContextFactoryName : sslContextFactoryNames) {
                    if ((result == null) && (sslContextFactoryName != null)) {
                        try {
                            Class<? extends SslContextFactory> sslContextFactoryClass = Class
                                    .forName(sslContextFactoryName).asSubclass(
                                            SslContextFactory.class);
                            result = sslContextFactoryClass.newInstance();
                            result.init(helper.getHelpedParameters());
                        } catch (ClassNotFoundException e) {
                            Context.getCurrentLogger().log(
                                    Level.WARNING,
                                    "Unable to find SslContextFactory class: "
                                            + sslContextFactoryName, e);
                        } catch (ClassCastException e) {
                            Context.getCurrentLogger()
                                    .log(Level.WARNING,
                                            "Class "
                                                    + sslContextFactoryName
                                                    + " does not implement SslContextFactory.",
                                            e);
                        } catch (InstantiationException e) {
                            Context.getCurrentLogger().log(
                                    Level.WARNING,
                                    "Could not instantiate class "
                                            + sslContextFactoryName
                                            + " with default constructor.", e);
                        } catch (IllegalAccessException e) {
                            Context.getCurrentLogger().log(
                                    Level.WARNING,
                                    "Illegal access when instantiating class "
                                            + sslContextFactoryName + ".", e);
                        }
                    }
                }
            }
        }

        if (result == null) {
            result = new DefaultSslContextFactory();
            result.init(helper.getHelpedParameters());
        }

        return result;
    }
View Full Code Here

Examples of org.restlet.ext.ssl.SslContextFactory

        new Thread() {
            @Override
            public void run() {
                try {
                    // Creates the server socket
                    SslContextFactory contextFactory = SslUtils
                            .getSslContextFactory(SdcClientHelper.this);
                    SSLServerSocketFactory ssf = contextFactory
                            .createSslContext().getServerSocketFactory();
                    SSLServerSocket serverSocket = (SSLServerSocket) ssf
                            .createServerSocket(getServerPort());

                    // Accept the next socket
View Full Code Here

Examples of org.restlet.ext.ssl.SslContextFactory

    protected void configure(SchemeRegistry schemeRegistry) {
        schemeRegistry.register(new Scheme("http", PlainSocketFactory
                .getSocketFactory(), 80));

        SSLSocketFactory sslSocketFactory = null;
        SslContextFactory sslContextFactory = SslUtils
                .getSslContextFactory(this);

        if (sslContextFactory != null) {
            try {
                SSLContext sslContext = sslContextFactory.createSslContext();
                sslSocketFactory = new SSLSocketFactory(sslContext);
            } catch (Exception e) {
                throw new RuntimeException("Unable to create SSLContext.", e);
            }
        } else {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.