Package javax.net.ssl

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


            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 soTimeout = HttpConnectionParams.getSoTimeout(params);

            SSLSocket sslsock = (SSLSocket) ((sock != null) ? sock : createSocket(params));
            if (localAddress != null) sslsock.bind(localAddress);

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

        public boolean isSecure(Socket sock) throws IllegalArgumentException {
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

        SSLSocketFactory sslsocketfactory = getSSLContext().getSocketFactory();
        SSLSocket sock = (SSLSocket) sslsocketfactory.createSocket();
       
        try {           
            sock.connect(new InetSocketAddress(serverHostname,serverPort), TIME_OUT);
            InputStream sockInput = sock.getInputStream();
            OutputStream sockOutput = sock.getOutputStream();

            log.info("About to start reading/writing to/from socket.");
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

            remoteAddress = new InetSocketAddress(this.nameResolver.resolve(host), port);
        } else {
            remoteAddress = new InetSocketAddress(host, port);           
        }
        try {
            sslsock.connect(remoteAddress, connTimeout);
        } catch (SocketTimeoutException ex) {
            throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out");
        }
        sslsock.setSoTimeout(soTimeout);
        try {
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);           
        }
        try {
            sslsock.connect(remoteAddress, connTimeout);
        } catch (SocketTimeoutException ex) {
            throw new ConnectTimeoutException("Connect to " + remoteAddress + " timed out");
        }
        sslsock.setSoTimeout(soTimeout);
        try {
View Full Code Here

    if (connectivity && method == Method.SSL) {
      SSLSocketFactory socketFactory =
          (SSLSocketFactory) SSLSocketFactory.getDefault();
      try {
        SSLSocket socket = (SSLSocket) socketFactory.createSocket();
        socket.connect(new InetSocketAddress(hostname, port), 3000);
        socket.setSoTimeout(3000);
        socket.getInputStream().read();
        insertMessage(form, "method",
            "Is this server Active Directory Controller?", null);
      } catch (SocketTimeoutException e) {
View Full Code Here

        // trying to bind to the correct ipaddress (in case of multiple vip addresses by example)
        // and let the JDK pick an ephemeral port
        sock.bind(new InetSocketAddress(myAddress, 0));
      }
      try {
        sock.connect(new InetSocketAddress(address, port), 8000);
      } catch (SocketTimeoutException e) {
        throw new ConnectException("Socket timeout error (8sec)" + address + ":" + port);
      }
      return sock;
    }
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.