Package javax.net.ssl

Examples of javax.net.ssl.SSLServerSocket


  }

  protected ServerSocket createServerSocket(int port, int backlog, String address) throws Exception {
    ServerSocketFactory serverSocketFactory = createServerSocketFactory();

    SSLServerSocket serverSocket = null;
    if (address.equals("0.0.0.0")) {
      serverSocket = (SSLServerSocket) serverSocketFactory.createServerSocket(port, backlog);
    } else {
      serverSocket = (SSLServerSocket) serverSocketFactory.createServerSocket(port, backlog, InetAddress.getByName(address));
    }

    // require mutual authentication
    serverSocket.setNeedClientAuth(true);
    // request mutual authentication
    //serverSocket.setWantClientAuth(true);
    String[] cipherTable = getCipherList();
    if (cipherTable != null && cipherTable.length > 0)
      serverSocket.setEnabledCipherSuites(cipherTable);

    return serverSocket;
  }
View Full Code Here


          if ( factory == null ){
                     
            throw( new TRTrackerServerException( "TRTrackerServer: failed to get SSL factory" ));
             
          }else{
            SSLServerSocket ssl_server_socket;
           
            if ( _bind_ip != null ){
             
              current_bind_ip = _bind_ip;
             
              ssl_server_socket = (SSLServerSocket)factory.createServerSocketgetPort(), 128, _bind_ip );

            }else if ( bind_ip == null ){
             
              ssl_server_socket = (SSLServerSocket)factory.createServerSocket( getPort(), 128 );
             
            }else{
             
              current_bind_ip = bind_ip;
             
              ssl_server_socket = (SSLServerSocket)factory.createServerSocketgetPort(), 128, bind_ip );
            }
   
            String cipherSuites[] = ssl_server_socket.getSupportedCipherSuites();
     
            ssl_server_socket.setEnabledCipherSuites(cipherSuites);
    
            ssl_server_socket.setNeedClientAuth(false);
           
            ssl_server_socket.setReuseAddress(true);
                           
            server_socket = ssl_server_socket;
           
            Thread accept_thread =
                new AEThread("TRTrackerServer:accept.loop(ssl)")
View Full Code Here

        }
       
        ServerSocket createSSLServerSocket(InetSocketAddress addr) throws Exception {
            SSLServerSocketFactory sslserversocketfactory =
                (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
            SSLServerSocket sslserversocket;
            sslserversocket=(SSLServerSocket)sslserversocketfactory.createServerSocket(addr.getPort(), 10, addr.getAddress());
            return sslserversocket;
        }
View Full Code Here

     */
    protected ServerSocket getServerSocket() throws IOException {
        // Just to make sure it's set before we start
        SSLContext context = getSSLContext(this.keystore, this.password);
        SSLServerSocketFactory factory = context.getServerSocketFactory();
        SSLServerSocket ss = (SSLServerSocket) (this.listenAddress == null ? factory
                .createServerSocket(this.listenPort, BACKLOG_COUNT)
                : factory.createServerSocket(this.listenPort, BACKLOG_COUNT,
                        InetAddress.getByName(this.listenAddress)));
        ss.setEnableSessionCreation(true);
        ss.setWantClientAuth(true);
        return ss;
    }
View Full Code Here

   @Override
   public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress) throws IOException
   {
      initSSLContext();
      SSLServerSocketFactory factory = sslCtx.getServerSocketFactory();
      SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket(port, backlog, ifAddress);
      SSLSessionContext ctx = sslCtx.getServerSessionContext();
      if (log.isDebugEnabled())
      {
         log.debug(ctx);
         String[] supportedProtocols = socket.getSupportedProtocols();
         log.debug("Supported protocols: " + Arrays.asList(supportedProtocols));
         String[] supportedCipherSuites = socket.getSupportedCipherSuites();
         log.debug("Supported CipherSuites: " + Arrays.asList(supportedCipherSuites));
      }
      socket.setNeedClientAuth(isNeedsClientAuth());
      if (!isNeedsClientAuth())
      {
        socket.setWantClientAuth(wantsClientAuth);
      }

      if (protocols != null)
         socket.setEnabledProtocols(protocols);
      if (cipherSuites != null)
         socket.setEnabledCipherSuites(cipherSuites);

      DomainServerSocket handler = new DomainServerSocket(socket);
      ProxyFactory pf = new ProxyFactory();
      pf.setHandler(handler);
      pf.setSuperclass(SSLServerSocket.class);
      Class[] sig = {};
      Object[] args = {};

      SSLServerSocket proxy = null;
      try
      {
         proxy = (SSLServerSocket) pf.create(sig, args);
      }
      catch (Exception e)
View Full Code Here

   public ServerSocket createServerSocket() throws IOException
   {
      initSSLContext();
      SSLServerSocketFactory factory = sslCtx.getServerSocketFactory();
      SSLServerSocket socket = (SSLServerSocket) factory.createServerSocket();
      SSLSessionContext ctx = sslCtx.getServerSessionContext();
      if (log.isDebugEnabled())
      {
         log.debug(ctx);
         String[] supportedProtocols = socket.getSupportedProtocols();
         log.debug("Supported protocols: " + Arrays.asList(supportedProtocols));
         String[] supportedCipherSuites = socket.getSupportedCipherSuites();
         log.debug("Supported CipherSuites: " + Arrays.asList(supportedCipherSuites));
      }
      socket.setNeedClientAuth(isNeedsClientAuth());
      if (!isNeedsClientAuth())
      {
        socket.setWantClientAuth(wantsClientAuth);
      }
      if( protocols != null )
         socket.setEnabledProtocols(protocols);
      if( cipherSuites != null )
         socket.setEnabledCipherSuites(cipherSuites);

      DomainServerSocket handler = new DomainServerSocket(socket);
      ProxyFactory pf = new ProxyFactory();
      pf.setHandler(handler);
      pf.setSuperclass(SSLServerSocket.class);
      Class[] sig = {};
      Object[] args = {};

      SSLServerSocket proxy = null;
      try
      {
         proxy = (SSLServerSocket) pf.create(sig, args);
      }
      catch (Exception e)
View Full Code Here

   public void testJSSE() throws Exception
   {
      log.debug("+++ testJSSE");
      ServerSocketFactory factory =
         SSLServerSocketFactory.getDefault();
      SSLServerSocket sslSocket = (SSLServerSocket)
         factory.createServerSocket(0);
      int port = sslSocket.getLocalPort();

      String [] cipherSuites = sslSocket.getEnabledCipherSuites();
      for(int i = 0; i < cipherSuites.length; i++)
      {
         getLog().debug("Cipher Suite " + i +
         " = " + cipherSuites[i]);
      }
      sslSocket.close();
   }
View Full Code Here

   // JacORB ServerSocketFactory implementation ------------------
   // (interface org.jacorb.orb.factory.ServerSocketFactory)

   public ServerSocket createServerSocket(int port) throws IOException
   {
      SSLServerSocket s = (SSLServerSocket) domainFactory.createServerSocket(port);

      if (request_mutual_auth)
         s.setWantClientAuth(request_mutual_auth);
      else if (require_mutual_auth)
         s.setNeedClientAuth(require_mutual_auth);

      return s;
   }
View Full Code Here

      return s;
   }

   public ServerSocket createServerSocket(int port, int backlog) throws IOException
   {
      SSLServerSocket s = (SSLServerSocket) domainFactory.createServerSocket(port, backlog);

      if (request_mutual_auth)
         s.setWantClientAuth(request_mutual_auth);
      else if (require_mutual_auth)
         s.setNeedClientAuth(require_mutual_auth);

      return s;
   }
View Full Code Here

      return s;
   }

   public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress) throws IOException
   {
      SSLServerSocket s = (SSLServerSocket) domainFactory.createServerSocket(port, backlog, ifAddress);

      if (request_mutual_auth)
         s.setWantClientAuth(request_mutual_auth);
      else if (require_mutual_auth)
         s.setNeedClientAuth(require_mutual_auth);

      return s;
   }
View Full Code Here

TOP

Related Classes of javax.net.ssl.SSLServerSocket

Copyright © 2018 www.massapicom. 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.