Package javax.net.ssl

Examples of javax.net.ssl.SSLSocket.connect()


      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);
      socket.addHandshakeCompletedListener(this);
View Full Code Here


        this.initSSLContext();
        InetAddress address = InetAddress.getByName(host);

        SSLSocketFactory socketFactory = this.sslContext.getSocketFactory();
        SSLSocket socket = (SSLSocket) socketFactory.createSocket();
        socket.connect(new InetSocketAddress(address, port), timeout);
        if (this.jsseSecurityDomain.getProtocols() != null)
            socket.setEnabledProtocols(this.jsseSecurityDomain.getProtocols());
        if (this.jsseSecurityDomain.getCipherSuites() != null)
            socket.setEnabledCipherSuites(this.jsseSecurityDomain.getCipherSuites());
        socket.setNeedClientAuth(this.jsseSecurityDomain.isClientAuth());
View Full Code Here

            }
            InetSocketAddress isa = new InetSocketAddress( localAddress, localPort );
            sslsock.bind( isa );
        }

        sslsock.connect( remoteAddress, connTimeout );
        sslsock.setSoTimeout( soTimeout );
        return sslsock;

    }
View Full Code Here

            remoteAddress = new InetSocketAddress(this.nameResolver.resolve(host), port);
        } else {
            remoteAddress = new InetSocketAddress(host, port);           
        }
       
        sslsock.connect(remoteAddress, connTimeout);

        sslsock.setSoTimeout(soTimeout);
        try {
            hostnameVerifier.verify(host, sslsock);
            // verifyHostName() didn't blowup - good!
View Full Code Here

        int connTimeout = HttpConnectionParams.getConnectionTimeout(params);
        int soTimeout = HttpConnectionParams.getSoTimeout(params);

        try {
            sslsock.connect(remoteAddress, connTimeout);
        } catch (SocketTimeoutException ex) {
            throw new ConnectTimeoutException("Connect to " + remoteAddress.getHostName() + "/"
                    + remoteAddress.getAddress() + " timed out");
        }
        sslsock.setSoTimeout(soTimeout);
View Full Code Here

            remoteAddress = new InetSocketAddress(this.nameResolver.resolve(host), port);
        } else {
            remoteAddress = new InetSocketAddress(host, port);           
        }
       
        sslsock.connect(remoteAddress, connTimeout);

        sslsock.setSoTimeout(soTimeout);
        try {
            hostnameVerifier.verify(host, sslsock);
            // verifyHostName() didn't blowup - good!
View Full Code Here

            } catch (SocketException e) {
            logger.log(Level.WARNING, "HTTPS socket["+host+":"+port+
                   "]setReceiveBufferSize("+rxBufSize+"): "+e.toString(), e);
            }
            InetSocketAddress addr = new InetSocketAddress(host, port);
            s.connect(addr);

            return s;
        } catch (Exception e) {
            if (!(e instanceof IOException)) {
                IOException ex = new IOException(e.getMessage());
View Full Code Here

    public static Socket createSocket(InetAddress address, int port) throws IOException {
        Socket socket = null;
        setKeystore();
        SSLSocketFactory f = (SSLSocketFactory) SSLSocketFactory.getDefault();
        SSLSocket secureSocket = (SSLSocket) f.createSocket();
        secureSocket.connect(new InetSocketAddress(address, port), SysProperties.SOCKET_CONNECT_TIMEOUT);
        if (SysProperties.ENABLE_ANONYMOUS_SSL) {
            String[] list = secureSocket.getEnabledCipherSuites();
            list = addAnonymous(list);
            secureSocket.setEnabledCipherSuites(list);
        }
View Full Code Here

    }

    protected Socket doCreateSocket(String host, int port, int timeout) throws IOException
    {
        SSLSocket socket = (SSLSocket)factory.createSocket();
        socket.connect(new InetSocketAddress(host, port), timeout);

        initSSLSocket(socket);

        return socket;
    }
View Full Code Here

      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);
      socket.addHandshakeCompletedListener(this);
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.