Package javax.net.ssl

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


    }

    @Override
    public Socket createSocket(InetAddress host, int port) throws IOException {
        SSLSocketFactory sslfac = getSSLSocketFactory();
        Socket sock=sslfac.createSocket(host,port);
        setSocket(sock);
        return wrapSocket(sock);
    }

    @Override
View Full Code Here


    }

    @Override
    public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
        SSLSocketFactory sslfac = getSSLSocketFactory();
        Socket sock=sslfac.createSocket(address, port, localAddress, localPort);
        setSocket(sock);
        return wrapSocket(sock);
    }

    @Override
View Full Code Here

    private Socket startSSL(Socket sock, String host) throws IOException {
        SSLSocketFactory sslFactory = getSSLSocketFactory(host);
        SSLSocket secureSocket;
        if (sslFactory != null) {
            try {
                secureSocket = (SSLSocket) sslFactory.createSocket(sock,
                        sock.getInetAddress().getHostName(), sock.getPort(), true);
                secureSocket.setUseClientMode(false);
                if (log.isDebugEnabled()){
                    log.debug(port + "SSL transaction ok with cipher: " + secureSocket.getSession().getCipherSuite());
                }
View Full Code Here

     * @return An appropriately configured client SSLSocket.
     * @exception IOException if ssl socket can't be obtained and configured.
     */
    private Socket createSSLSocket(String host, int port, int requires, int supports) throws IOException {
        SSLSocketFactory factory = getSocketFactory();
        SSLSocket socket = (SSLSocket) factory.createSocket(host, port);

        socket.setSoTimeout(60 * 1000);

        // get a set of cipher suites appropriate for this connections requirements.
        // We request this for each connection, since the outgoing IOR's requirements may be different from
View Full Code Here

    @Test
    public void emptyConfigurationHasDefaultTrustStore() throws IOException {
        SslConfiguration sc = SslConfiguration.createSSLConfiguration(null, null, null);
        SSLSocketFactory factory = sc.getSslSocketFactory();
        SSLSocket clientSocket = (SSLSocket) factory.createSocket(TLS_TEST_HOST, TLS_TEST_PORT);
        Assert.assertTrue(true);
    }

    @Test(expected = IOException.class)
    public void connectionFailsWithoutValidServerCertificate() throws IOException, StoreConfigurationException {
View Full Code Here

    @Test(expected = IOException.class)
    public void connectionFailsWithoutValidServerCertificate() throws IOException, StoreConfigurationException {
        TrustStoreConfiguration tsc = new TrustStoreConfiguration(TestConstants.TRUSTSTORE_FILE, null, null, null);
        SslConfiguration sc = SslConfiguration.createSSLConfiguration(null, null, tsc);
        SSLSocketFactory factory = sc.getSslSocketFactory();
        SSLSocket clientSocket = (SSLSocket) factory.createSocket(TLS_TEST_HOST, TLS_TEST_PORT);
        OutputStream os = clientSocket.getOutputStream();
        os.write("GET config/login_verify2?".getBytes());
        Assert.assertTrue(false);
    }
View Full Code Here

        int timeout = params.getConnectionTimeout();
       
        SSLSocketFactory sslfac = getSSLSocketFactory();
        Socket socket;
        if (timeout == 0) {
          socket = sslfac.createSocket(host, port, localAddress, localPort);
        } else {
            socket = sslfac.createSocket();
            SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
            SocketAddress remoteaddr = new InetSocketAddress(host, port);
            socket.bind(localaddr);
View Full Code Here

        SSLSocketFactory sslfac = getSSLSocketFactory();
        Socket socket;
        if (timeout == 0) {
          socket = sslfac.createSocket(host, port, localAddress, localPort);
        } else {
            socket = sslfac.createSocket();
            SocketAddress localaddr = new InetSocketAddress(localAddress, localPort);
            SocketAddress remoteaddr = new InetSocketAddress(host, port);
            socket.bind(localaddr);
            socket.connect(remoteaddr, timeout);
        }
View Full Code Here

     * @see SecureProtocolSocketFactory#createSocket(java.lang.String,int)
     */
    public Socket createSocket(String host, int port)
        throws IOException, UnknownHostException {
        SSLSocketFactory sslfac = getSSLSocketFactory();
      Socket sock = sslfac.createSocket(
            host,
            port
        );
        setSocket(sock);
      return wrapSocket(sock);
View Full Code Here

        String host,
        int port,
        boolean autoClose)
        throws IOException, UnknownHostException {
        SSLSocketFactory sslfac = getSSLSocketFactory();
      Socket sock = sslfac.createSocket(
            socket,
            host,
            port,
            autoClose
        );
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.