Package javax.net.ssl

Examples of javax.net.ssl.SSLSocketFactory


                        TRUSTSTORE, TRUSTSTORE_PASSWORD,
                        KeyStore.getDefaultType(),
                        TrustManagerFactory.getDefaultAlgorithm(),
                        null, null, null, null, null);

                SSLSocketFactory sslSocketFactory = sslContext.getSocketFactory();

                ((HttpsURLConnection) httpCon).setSSLSocketFactory(sslSocketFactory);
            }
            catch (GeneralSecurityException e)
            {
View Full Code Here


        Socket createSocket(InetSocketAddress addr) throws Exception {
            return new Socket(addr.getAddress(), addr.getPort());
        }

        Socket createSSLSocket(InetSocketAddress addr) throws Exception {
            SSLSocketFactory sslsocketfactory = (SSLSocketFactory)SSLSocketFactory.getDefault();
            return sslsocketfactory.createSocket(addr.getAddress(), addr.getPort());
        }
View Full Code Here

   public Socket createSocket(InetAddress serverAddr, int serverPort,
                              InetAddress clientAddr, int clientPort)
      throws IOException
   {
      initSSLContext();
      SSLSocketFactory factory = sslCtx.getSocketFactory();
      SSLSocket socket =
         (SSLSocket)factory.createSocket(serverAddr, serverPort,
                                         clientAddr, clientPort);
      String[] supportedProtocols = socket.getSupportedProtocols();
      log.debug("Supported protocols: " + Arrays.asList(supportedProtocols));
      String[] protocols = supportedProtocols; // {"SSLv3"};
      socket.setEnabledProtocols(protocols);
View Full Code Here

   public Socket createSocket(InetAddress serverAddr,
                              int serverPort, int timeout)
      throws IOException
   {
      initSSLContext();
      SSLSocketFactory factory = sslCtx.getSocketFactory();
      SSLSocket socket = (SSLSocket)factory.createSocket();
      socket.connect(new InetSocketAddress(serverAddr, serverPort), timeout);
      String[] supportedProtocols = socket.getSupportedProtocols();
      log.debug("Supported protocols: " + Arrays.asList(supportedProtocols));
      String[] protocols = supportedProtocols; // {"SSLv3"};
      socket.setEnabledProtocols(protocols);
View Full Code Here

   public Socket createSocket(Socket s, String host,
                              int port, boolean autoClose)
      throws IOException
   {
      initSSLContext();
      SSLSocketFactory factory = sslCtx.getSocketFactory();
      SSLSocket socket =
         (SSLSocket)factory.createSocket(s, host, port, autoClose);
      String[] supportedProtocols = socket.getSupportedProtocols();
      String[] protocols = supportedProtocols; // {"SSLv3"};
      socket.setEnabledProtocols(protocols);
      socket.addHandshakeCompletedListener(this);
      socket.setNeedClientAuth(needsClientAuth);
View Full Code Here

   {
      String[] cipherSuites = {};
      try
      {
         initSSLContext();
         SSLSocketFactory factory = sslCtx.getSocketFactory();
         cipherSuites = factory.getDefaultCipherSuites();
      }
      catch(IOException e)
      {
         log.error("Failed to get default SSLSocketFactory", e);
      }     
View Full Code Here

   {
      String[] cipherSuites = {};
      try
      {
         initSSLContext();
         SSLSocketFactory factory = sslCtx.getSocketFactory();
         cipherSuites = factory.getSupportedCipherSuites();
      }
      catch(IOException e)
      {
         log.error("Failed to get default SSLSocketFactory", e);
      }     
View Full Code Here

   * @exception IOException if an I/O error occurs during socket creation.
   */
   public java.net.Socket createSocket(String host, int port)
      throws IOException
   {
      SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
      SSLSocket socket = (SSLSocket) factory.createSocket(host, port);
      socket.addHandshakeCompletedListener(this);
      socket.setWantClientAuth(wantsClientAuth);
      socket.setNeedClientAuth(needsClientAuth);
      log.debug("createSocket, host="+host+", port="+port
         +",needsClientAuth="+needsClientAuth+", wantsClientAuth="+wantsClientAuth);
View Full Code Here

   }
   public Socket createSocket(InetAddress serverAddr, int serverPort,
      InetAddress clientAddr, int clientPort)
      throws IOException
   {
      SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
      SSLSocket socket = (SSLSocket) factory.createSocket(serverAddr, serverPort, clientAddr, clientPort);
      socket.addHandshakeCompletedListener(this);
      socket.setNeedClientAuth(needsClientAuth);
      socket.setWantClientAuth(wantsClientAuth);
      return socket;
   }
View Full Code Here

        SSLContext context = SSLContext.getInstance("TLS");       
        CertChainCatcher catcher = new CertChainCatcher();
        context.init(null, new TrustManager[] {catcher}, null);
       
        SSLSocketFactory factory = context.getSocketFactory();
        SSLSocket socket = (SSLSocket)factory.createSocket(brokerUri.getHost(), brokerUri.getPort());
        socket.setSoTimeout(5000);
        socket.startHandshake();
        socket.close();
       
        boolean matches = false;
View Full Code Here

TOP

Related Classes of javax.net.ssl.SSLSocketFactory

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.