Examples of SSLSocketFactory


Examples of javax.net.ssl.SSLSocketFactory

     * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int,java.net.InetAddress,int)
     */
    public Socket createSocket(String host, int port,
                               InetAddress clientHost, int clientPort)
        throws IOException, UnknownHostException {
        SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();
        SSLSocket sslSocket = (SSLSocket) sf.createSocket(host, port,
                                                          clientHost,
                                                          clientPort);
        verifyHostname(sslSocket);

        return sslSocket;
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

    /**
     * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int)
     */
    public Socket createSocket(String host, int port)
        throws IOException, UnknownHostException {
        SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();
        SSLSocket sslSocket = (SSLSocket) sf.createSocket(host, port);
        verifyHostname(sslSocket);

        return sslSocket;
    }
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

     * @see SecureProtocolSocketFactory#createSocket(java.net.Socket,java.lang.String,int,boolean)
     */
    public Socket createSocket(Socket socket, String host, int port,
                               boolean autoClose)
        throws IOException, UnknownHostException {
        SSLSocketFactory sf = (SSLSocketFactory) SSLSocketFactory.getDefault();
        SSLSocket sslSocket = (SSLSocket) sf.createSocket(socket, host,
                                                          port, autoClose);
        verifyHostname(sslSocket);

        return sslSocket;
    }
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

  }
 
  @Override
  protected TcpConnection newConnection(InetAddress addr, int port) throws IOException
  {
    SSLSocketFactory sslsocketfactory = (SSLSocketFactory) SSLSocketFactory.getDefault();
        SSLSocket sslsocket = (SSLSocket) sslsocketfactory.createSocket(addr, port);
    return new TlsConnection(sslsocket);
  }
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

                    ks.load(in, KEYSTORE_PASSWORD);
                    kmf = KeyManagerFactory.getInstance(KEYMANAGERFACTORY);
                    kmf.init(ks, KEY_PASSWORD);
                    sslcontext = SSLContext.getInstance(SSLCONTEXT_PROTOCOL);
                    sslcontext.init(kmf.getKeyManagers(), null, null);
                    SSLSocketFactory sslFactory = sslcontext.getSocketFactory();
                    hashHost.put(host, sslFactory);
                    log.info("KeyStore for SSL loaded OK and put host in map ("+host+")");
                    return sslFactory;
                } catch (NoSuchAlgorithmException e) {
                    except=e;
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

     * @param host
     * @return a new client socket over ssl
     * @throws Exception if negotiation failed
     */
    private Socket startSSL(Socket sock, String host) throws IOException {
        SSLSocketFactory sslFactory = getSSLSocketFactory(host);
        SSLSocket secureSocket;
        if (sslFactory != null) {
            try {
                secureSocket = (SSLSocket) sslFactory.createSocket(sock,
                        sock.getInetAddress().getHostName(), sock.getPort(), true);
                secureSocket.setUseClientMode(false);
                if (log.isDebugEnabled()){
                    log.debug("SSL transaction ok with cipher: " + secureSocket.getSession().getCipherSuite());
                }
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

            return this.configureSSLServerSocketFactory(factory);
        }

        @Override
        protected SSLSocketFactory engineGetSocketFactory() {
            SSLSocketFactory factory = this.context.getSocketFactory();
            LOG.debug("SSLSocketFactory [{}] created from SSLContext [{}].", factory, context);
            return this.configureSSLSocketFactory(factory);
        }
View Full Code Here

Examples of javax.net.ssl.SSLSocketFactory

         *
         * @param factory the factory to configure
         * @return {@code factory} or a decorated instance there of
         */
        protected SSLSocketFactory configureSSLSocketFactory(SSLSocketFactory factory) {
            SSLSocketFactory workingFactory = factory;
           
            for (Configurer<SSLSocketFactory> configurer : this.sslSocketFactoryConfigurers) {
                workingFactory = configurer.configure(workingFactory);
            }
           
View Full Code Here

Examples of org.apache.http.conn.ssl.SSLSocketFactory

        HttpParams httpParams = new BasicHttpParams();

        SchemeRegistry registry = new SchemeRegistry();

        registry.register(new Scheme("http", PlainSocketFactory.getSocketFactory(), 80));
        SSLSocketFactory sslSocketFactory;
        if (null == sslContext)
        {
          sslSocketFactory = SSLSocketFactory.getSocketFactory();
        }
        else
        {
          sslSocketFactory = new SSLSocketFactory(sslContext);
        }
        if (null != hostnameVerifier)
        {
          sslSocketFactory.setHostnameVerifier(hostnameVerifier);
        }
        registry.register(new Scheme("https", sslSocketFactory, 443));
       
        ClientConnectionManager connManager;
        if (multiThreadedHttpClient)
View Full Code Here

Examples of org.apache.http.conn.ssl.SSLSocketFactory

                            Integer.toString(443)
                        }
                    ));

        Scheme sch = new Scheme("https", 443,
            new SSLSocketFactory(
                    sslCtx, SSLSocketFactory.ALLOW_ALL_HOSTNAME_VERIFIER));
        httpClient.getConnectionManager().getSchemeRegistry().register(sch);

        // set proxy from default jre settings
        ProxySelectorRoutePlanner routePlanner = new ProxySelectorRoutePlanner(
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.