Package javax.net.ssl

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


        InetAddress clientHost,
        int clientPort)
        throws IOException, UnknownHostException {

        SSLSocketFactory sslfac = getSSLSocketFactory();
        Socket sock = sslfac.createSocket(
            host,
            port,
            clientHost,
            clientPort
        );
View Full Code Here


        return wrapSocket(sock);
    }

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

  public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort) throws IOException {
View Full Code Here

    return wrapSocket(sock);
  }

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

  public String[] getDefaultCipherSuites() {
View Full Code Here

        SSLSocketFactory socFactory = ctx.getSocketFactory();
       
        // create socket
        SSLSocket ssoc;
        if(localPort != 0) {
            ssoc = (SSLSocket)socFactory.createSocket(address2, port2);
        } else {
            ssoc = (SSLSocket)socFactory.createSocket(address2, port2, localAddress, localPort);
        }
        ssoc.setUseClientMode(clientMode);
       
View Full Code Here

        // create socket
        SSLSocket ssoc;
        if(localPort != 0) {
            ssoc = (SSLSocket)socFactory.createSocket(address2, port2);
        } else {
            ssoc = (SSLSocket)socFactory.createSocket(address2, port2, localAddress, localPort);
        }
        ssoc.setUseClientMode(clientMode);
       
       
        // initialize socket
View Full Code Here

        tomcat.start();
        SSLContext sslCtx = SSLContext.getInstance("TLS");
        sslCtx.init(null, TesterSupport.getTrustManagers(), null);
        SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
        SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost", getPort());

        socket.addHandshakeCompletedListener(new HandshakeCompletedListener() {
            @Override
            public void handshakeCompleted(HandshakeCompletedEvent event) {
                handshakeDone = true;
View Full Code Here

        tomcat.start();

        SSLContext sslCtx = SSLContext.getInstance("TLS");
        sslCtx.init(null, TesterSupport.getTrustManagers(), null);
        SSLSocketFactory socketFactory = sslCtx.getSocketFactory();
        SSLSocket socket = (SSLSocket) socketFactory.createSocket("localhost",
                getPort());

        OutputStream os = socket.getOutputStream();

        os.write("GET /examples/servlets/servlet/HelloWorldExample HTTP/1.1\n".getBytes());
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

      port = hostURL.getPort();
      if (port == -1) {
        port = 443;
      }
      factory = HttpsURLConnection.getDefaultSSLSocketFactory();
      socket = (SSLSocket) factory.createSocket(hostname, port);

      // Connect to the server
      socket.startHandshake();

      // Retrieve the server's certificate chain
View Full Code Here

        SSLSocketFactory socketFactory =
                ((SSLSocketFactory) SSLSocketFactory.getDefault());
        InetSocketAddress remoteAddress =
                (InetSocketAddress) socket.getRemoteSocketAddress();
        SSLSocket sslSocket =
                (SSLSocket) (socketFactory.createSocket(socket,
                        remoteAddress.getHostName(), socket.getPort(), true));

        // we are a server
        sslSocket.setUseClientMode(false);
        return sslSocket;
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.