Package javax.net.ssl

Examples of javax.net.ssl.SSLSocketFactory


   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

   }
  
   public Socket createSocket() throws IOException
   {
       initSSLContext();
       SSLSocketFactory factory = sslCtx.getSocketFactory();
       SSLSocket socket = (SSLSocket) factory.createSocket();
       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

        try {
            SSLContext sslCtx = SSLContext.getInstance("SSL");
            KeyManager[] aKM = SSLKeyManager.getKeyManagerArray();
            TrustManager[] aTM = SSLTrustManager.getTrustManagerArray();
            sslCtx.init(aKM, aTM, null);
            SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
            return socketFactory;
        } catch (KeyManagementException e) {
            log.error("Cannot create SSL socket", e);
            throw new IOException("Cannot create SSL socket: " + e.getMessage());
        } catch (NoSuchAlgorithmException e) {
View Full Code Here

            // initializing the ssl context
            if (this.log.isFine()) this.log.logFine("Initializing SSL context ...");
            final SSLContext sslcontext = SSLContext.getInstance("TLS");
            sslcontext.init(kmf.getKeyManagers(), null, null);
           
            final SSLSocketFactory factory = sslcontext.getSocketFactory();
            this.log.logInfo("SSL support initialized successfully");
            return factory;
        } catch (final Exception e) {
            final String errorMsg = "FATAL ERROR: Unable to initialize the SSL Socket factory. " + e.getMessage();
            this.log.logSevere(errorMsg);
View Full Code Here

    super(host, timeout);
  }

  @Override
  protected Socket createSocket() throws IOException {
    SSLSocketFactory factory = HttpsURLConnection.getDefaultSSLSocketFactory();
    SSLSocket sslSocket = (SSLSocket) factory.createSocket();
    sslSocket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
          @Override
          public void handshakeCompleted(HandshakeCompletedEvent event) {
            ThreadLocalMetricsRecorder.getInstance().getSslTimer().stop();
          }
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.