Package javax.net

Examples of javax.net.SocketFactory.createSocket()


            throw new IllegalArgumentException("Parameters may not be null");
        }
        int timeout = params.getConnectionTimeout();
        SocketFactory socketfactory = getSSLContext(host).getSocketFactory();
        if (timeout == 0) {
            return socketfactory.createSocket(host, port, localAddress, localPort);
        }
        else {
            Socket socket = socketfactory.createSocket();
            SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
            SocketAddress remoteaddr = new InetSocketAddress(host, port);
View Full Code Here


        SocketFactory socketfactory = getSSLContext(host).getSocketFactory();
        if (timeout == 0) {
            return socketfactory.createSocket(host, port, localAddress, localPort);
        }
        else {
            Socket socket = socketfactory.createSocket();
            SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
            SocketAddress remoteaddr = new InetSocketAddress(host, port);
            socket.bind(localaddr);
            socket.connect(remoteaddr, timeout);
            return socket;
View Full Code Here

                tcpPort = url.getPort();
                if (tcpPort < 0 || tcpPort > 65535) {
                    throw new InterpreterException(StdErrors.extend(StdErrors.Out_of_range, "" + tcpPort));
                }
                SocketFactory socketFactory = SSLSocketFactory.getDefault();
                socket = socketFactory.createSocket(tcpHost, tcpPort);
                if (readTimeOut > 0) {
                    socket.setSoTimeout(readTimeOut);
                }
                tcpIP = socket.getInetAddress().getHostAddress();
                tcpHost = socket.getInetAddress().getHostName();
View Full Code Here

    }   

    public Connection createConnection(String host, int port) throws IOException {
        try {
            SocketFactory socketFactory = SSLSocketFactory.getDefault();
            Socket socket = socketFactory.createSocket(host, port);

            return new SocketConnection(socket);

        } catch (Exception e) {
            throw new IOException(e.getMessage());
View Full Code Here

    public void open(String pAddress, int pPort) {
        // Create a socket connection
        SocketFactory factory = SSLSocketFactory.getDefault();
        try {
            socket = factory.createSocket(pAddress, pPort);
            InputStream in = socket.getInputStream();
            inStream = new InputStreamReader(in);
            outStream = socket.getOutputStream();
        } catch (UnknownHostException e) {
            e.printStackTrace();
View Full Code Here

    public void open(String pAddress, int pPort) {
        // Create a socket connection
        SocketFactory factory = SSLSocketFactory.getDefault();
        try {
            socket = factory.createSocket(pAddress, pPort);
            InputStream in = socket.getInputStream();
            inStream = new InputStreamReader(in);
            outStream = socket.getOutputStream();
        } catch (UnknownHostException e) {
            e.printStackTrace();
View Full Code Here

    public void open(String pAddress, int pPort) {
        // Create a socket connection
        SocketFactory factory = SSLSocketFactory.getDefault();
        try {
            socket = factory.createSocket(pAddress, pPort);
            InputStream in = socket.getInputStream();
            inStream = new InputStreamReader(in);
            outStream = socket.getOutputStream();
        } catch (UnknownHostException e) {
            e.printStackTrace();
View Full Code Here

            public Object run() throws IOException {
                SocketFactory sf = SocketFactory.getDefault();
                InetSocketAddress sockAddr = new InetSocketAddress(
                        slaveAddress.getHostAddress(),
                        slaveAddress.getPortNumber());
                Socket s_temp = sf.createSocket();
                s_temp.connect(sockAddr, timeout_);
                return s_temp;
            }
        });
       
View Full Code Here

            if (port == -1) {
                port = 443;
            }
            try {
                SocketFactory factory = SSLSocketFactory.getDefault();
                socket = factory.createSocket(host, port);
            } catch (UnknownHostException uhe) {
                throw new WebSocketException("unknown host: " + host, uhe);
            } catch (IOException ioe) {
                throw new WebSocketException("error while creating secure socket to " + url, ioe);
            }
View Full Code Here

                            }
                            if (trustStorePassword != null) {
                                System.setProperty("javax.net.ssl.trustStorePassword", trustStorePassword);
                            }
                            SocketFactory socketFactory = SSLSocketFactory.getDefault();
                            socket = socketFactory.createSocket(hostname, port);
                        }
                    } else {
                        socket = new Socket(hostname, port);
                    }
                    conn.bind(socket, params);
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.