Package javax.net.ssl

Examples of javax.net.ssl.SSLSocketFactory.createSocket()


    SSLSocketFactory factory = (SSLSocketFactory)SSLSocketFactory.getDefault();
    SSLSocket socket = null;

    if (! useProxy) {
     
      socket = (SSLSocket)factory.createSocket(host,port);

    } else {
     
      Socket tunnel = new Socket(proxyHost, proxyPort);
      doTunnelHandshake(tunnel, host, port);
View Full Code Here


      doTunnelHandshake(tunnel, host, port);
     
      /*
       * Ok, let's overlay the tunnel socket with SSL.
       */
      socket = (SSLSocket)factory.createSocket(tunnel, host, port, true);
     
      /*
       * send http request
       *
       * See SSLSocketClient.java for more information about why
View Full Code Here

                    // get socket factory
                    SSLSocketFactory socFactory = ssl.getSocketFactory();

                    // create socket
                    SSLSocket ssoc = (SSLSocket) socFactory.createSocket();
                    ssoc.setUseClientMode(false);

                    // initialize socket
                    if (ssl.getEnabledCipherSuites() != null) {
                        ssoc.setEnabledCipherSuites(ssl.getEnabledCipherSuites());
View Full Code Here

                    SSLSocketFactory ssocketFactory = ssl.getSocketFactory();

                    Socket serverSocket = servSoc.accept();

                    SSLSocket sslSocket = (SSLSocket) ssocketFactory
                            .createSocket(serverSocket, serverSocket
                                    .getInetAddress().getHostAddress(),
                                    serverSocket.getPort(), true);
                    sslSocket.setUseClientMode(false);
View Full Code Here

            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());
        }

        ServerSocket createServerSocket(InetSocketAddress addr) throws Exception {
            return new ServerSocket(addr.getPort(), 10, addr.getAddress());
        }
View Full Code Here

    SSLSocket s = null;
    for (int i = 0; i < ports.length && s == null; i++) {
      try {
        if (sf == null)
          sf = SSLSocketFactoryFactory.createSSLSocketFactory(getTrustManagers());
        s = (SSLSocket)sf.createSocket(host, ports[i]);
        s.startHandshake();
        exception = null;
      } catch (SSLNotSupportedException exc) {
        if (s != null)
          s.close();
View Full Code Here

          sc.init(null, trustAllCerts, RandomUtils.SECURE_RANDOM );
       
          SSLSocketFactory factory = sc.getSocketFactory();

          try{
            socket_out = factory.createSocket();
           
            socket_out.connect( new InetSocketAddress( delegate_to_host, delegate_to_port ), CONNECT_TIMEOUT );
         
          }catch( SSLException ssl_excep ){
                       
View Full Code Here

         
          }catch( SSLException ssl_excep ){
                       
            factory = SESecurityManager.installServerCertificates( "AZ-sniffer:" + delegate_to_host + ":" + port, delegate_to_host, delegate_to_port );
           
            socket_out = factory.createSocket();
           
            socket_out.connect( new InetSocketAddress( delegate_to_host, delegate_to_port ), 30*1000 );         
          }
        }else{
         
View Full Code Here

    SSLSocket s = null;
    for (int i = 0; i < ports.length && s == null; i++) {
      try {
        if (sf == null)
          sf = getSocketFactory();
        s = (SSLSocket)sf.createSocket(host, ports[i]);
        s.startHandshake();
        exception = null;
      } catch (IOException exc) {
        if (s != null)
          s.close();
View Full Code Here

   */
  public SSLSocket createSSLSocket(Socket socket) throws IOException
  {
    SSLSocketFactory sf = ((SSLSocketFactory) SSLSocketFactory.getDefault());
    InetSocketAddress remoteAddress = (InetSocketAddress) socket.getRemoteSocketAddress();
    SSLSocket s = (SSLSocket) (sf.createSocket(socket, remoteAddress.getHostName(), socket.getPort(), true));

    // we are a server
    s.setUseClientMode(false);

    // allow all supported cipher suites
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.