Examples of SSLSocket


Examples of javax.net.ssl.SSLSocket

        return socket;
    }

    public Socket createSocket(String host, int port) throws IOException, UnknownHostException {
        SSLSocket socket = null;
        socket = (SSLSocket)sslSocketFactory.createSocket(host, port);
        if ((socket != null) && (ciphers != null)) {
            socket.setEnabledCipherSuites(ciphers);
        }
        if (socket == null) {
            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
                         new Object[]{host, port});
        }
View Full Code Here

Examples of javax.net.ssl.SSLSocket

    }


    public Socket createSocket(String host, int port, InetAddress localHost, int localPort)
        throws IOException, UnknownHostException {
        SSLSocket socket = null;
        socket = (SSLSocket)sslSocketFactory.createSocket(host, port, localHost, localPort);
        if ((socket != null) && (ciphers != null)) {
            socket.setEnabledCipherSuites(ciphers);
        }

        if (socket == null) {
            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
                         new Object[]{host, port});
View Full Code Here

Examples of javax.net.ssl.SSLSocket

        return socket;
    }


    public Socket createSocket(InetAddress host, int port) throws IOException {
        SSLSocket socket = null;
        socket = (SSLSocket)sslSocketFactory.createSocket(host, port);
        if ((socket != null) && (ciphers != null)) {
            socket.setEnabledCipherSuites(ciphers);
        }

        if (socket == null) {
            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
                         new Object[]{host, port});
View Full Code Here

Examples of javax.net.ssl.SSLSocket

    }


    public Socket createSocket(InetAddress address, int port, InetAddress localAddress, int localPort)
        throws IOException {
        SSLSocket socket = null;
        socket = (SSLSocket)sslSocketFactory.createSocket(address, port, localAddress, localPort);
        if ((socket != null) && (ciphers != null)) {
            socket.setEnabledCipherSuites(ciphers);
        }

        if (socket == null) {
            LogUtils.log(LOG, Level.SEVERE, "PROBLEM_CREATING_OUTBOUND_REQUEST_SOCKET",
                         new Object[]{address, port});
View Full Code Here

Examples of javax.net.ssl.SSLSocket

        return;
      }

      sess.sendResponse("220 Ready to start TLS");

      SSLSocket s = sess.getServer().createSSLSocket(socket);
      s.startHandshake();
      log.debug("Cipher suite: " + s.getSession().getCipherSuite());

      sess.setSocket(s);
      sess.resetMessageState(); // clean slate
      sess.setTlsStarted(true);

      if (s.getNeedClientAuth())
      {
        try
        {
          Certificate[] peerCertificates = s.getSession().getPeerCertificates();
          sess.setTlsPeerCertificates(peerCertificates);
        }
        catch (SSLPeerUnverifiedException e)
        {
          // IGNORE, just leave the certificate chain null
View Full Code Here

Examples of javax.net.ssl.SSLSocket

   */
  public SSLSocket createSSLSocket(Socket socket) throws IOException
  {
    SSLSocketFactory sf = ((SSLSocketFactory) SSLSocketFactory.getDefault());
    InetSocketAddress remoteAddress = (InetSocketAddress) socket.getRemoteSocketAddress();
    SSLSocket s = (SSLSocket) (sf.createSocket(socket, remoteAddress.getHostName(), socket.getPort(), true));

    // we are a server
    s.setUseClientMode(false);

    // allow all supported cipher suites
    s.setEnabledCipherSuites(s.getSupportedCipherSuites());

    return s;
  }
View Full Code Here

Examples of javax.net.ssl.SSLSocket

     */
    protected void parseSocketInfo(Socket socket, WinstoneRequest req)
            throws IOException {
        super.parseSocketInfo(socket, req);
        if (socket instanceof SSLSocket) {
            SSLSocket s = (SSLSocket) socket;
            SSLSession ss = s.getSession();
            if (ss != null) {
                Certificate certChain[] = null;
                try {
                    certChain = ss.getPeerCertificates();
                } catch (Throwable err) {/* do nothing */
 
View Full Code Here

Examples of javax.net.ssl.SSLSocket

            EasyMock.expect(sslSocketFactory.createSocket((String)EasyMock.anyObject(),
                                                          EasyMock.anyInt())).andReturn(mockSocket);
            EasyMock.expect(sslSocketFactory.getDefaultCipherSuites()).andReturn(ciphs);
            EasyMock.expect(sslSocketFactory.getSupportedCipherSuites()).andReturn(ciphs);
            EasyMock.replay(sslSocketFactory);
            SSLSocket socket = 
                (SSLSocket)sslSocketFactoryWrapper.createSocket("localhost", 9001);
            assertTrue("Expected socket != null", socket != null);
            String[] defCiphers = sslSocketFactoryWrapper.getDefaultCipherSuites();
            assertTrue("Default Cipher suite not as expected", defCiphers[1].equals("b"));
            String[] suppCiphers = sslSocketFactoryWrapper.getSupportedCipherSuites();
View Full Code Here

Examples of javax.net.ssl.SSLSocket

   public Socket createSocket(InetAddress serverAddr, int serverPort,
      InetAddress clientAddr, int clientPort)
      throws IOException
   {
      SSLSocketFactory factory = (SSLSocketFactory) SSLSocketFactory.getDefault();
      SSLSocket socket = (SSLSocket) factory.createSocket(serverAddr, serverPort, clientAddr, clientPort);
      socket.addHandshakeCompletedListener(this);
      socket.setNeedClientAuth(needsClientAuth);
      socket.setWantClientAuth(wantsClientAuth);
      return socket;
   }
View Full Code Here

Examples of javax.net.ssl.SSLSocket

   }

   public Socket accept()
      throws IOException
   {
      SSLSocket socket = (SSLSocket) delegate.accept();
      socket.addHandshakeCompletedListener(this);
      return socket;
   }
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.