Examples of ServerSocketFactory


Examples of com.sun.grizzly.util.net.ServerSocketFactory

        //XXX need to revisit if the value should be cached
        return System.getProperty(KEYSTORE_PASS_PROP, "changeit");
    }

    private SSLContext getSSLContext(SipBindingCtx sipBindingCtx) {
        ServerSocketFactory serverSF = null;

        try {
            //TODO This expects that the ServerSocketFactory initialized

            //is a seperated instance. A brief check of the grizzly

            //classes involved reveals that it is for the default JSSE14 factories
            SSLImplementation sslHelper = SSLImplementation.getInstance();

            serverSF = sslHelper.getServerSocketFactory();

            serverSF.setAttribute("keystoreType", "JKS");

            serverSF.setAttribute("keystore", keyStore);
            serverSF.setAttribute("keystorePass", keypass);
            serverSF.setAttribute("keypass", keypass);

            serverSF.setAttribute("truststoreType", "JKS");

            serverSF.setAttribute("truststore", trustStore);

            String keyAlias = sipBindingCtx.getSSLAttribute("CertNickname");

            serverSF.setAttribute("keyAlias",
                    ((keyAlias != null) ? keyAlias : "s1as")); //Default GF s1sa

            serverSF.init();
        } catch (IOException e) {
        //TODO Logging
        } catch (ClassNotFoundException e) {
        //TODO Logging
        }

        return serverSF.getSSLContext();
    }
View Full Code Here

Examples of javax.net.ServerSocketFactory

    return ctx.getServerSocketFactory();
  }

  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
View Full Code Here

Examples of javax.net.ServerSocketFactory

   /** Test the JSSE installation
    */
   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++)
      {
View Full Code Here

Examples of javax.net.ServerSocketFactory

      {
         log.error("Failed to init SSLContext", e);
         throw new IOException("Failed to get SSLContext for TLS algorithm");
      }

      ServerSocketFactory factory = sslCtx.getServerSocketFactory();
      ServerSocket serverSocket = factory.createServerSocket(0);
      getLog().debug("Created serverSocket: "+serverSocket);
      int port = serverSocket.getLocalPort();
      InetAddress addr = serverSocket.getInetAddress();
      httpsURL = "https://localhost:" + port + '/';
      AcceptThread thread = new AcceptThread(serverSocket, getLog(), httpsURL);
View Full Code Here

Examples of javax.net.ServerSocketFactory

                     
    // Create the right kind of socket
    switch (getSSLMode()) {
    case SSL_OFF:
    default:
      ServerSocketFactory sf =
        ServerSocketFactory.getDefault();
      return sf.createServerSocket(portNumber
                     ,0,
                     hostAddress);
    case SSL_BASIC:
      SSLServerSocketFactory ssf =
        (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
View Full Code Here

Examples of javax.net.ServerSocketFactory

                     
    // Create the right kind of socket
    switch (getSSLMode()) {
    case SSL_OFF:
    default:
      ServerSocketFactory sf =
        ServerSocketFactory.getDefault();
      return sf.createServerSocket(portNumber
                     ,0,
                     hostAddress);
    case SSL_BASIC:
      SSLServerSocketFactory ssf =
        (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
View Full Code Here

Examples of javax.net.ServerSocketFactory

            next.start();

            ServerSocket serverSocket;
            try {
                if (secure) {
                    ServerSocketFactory factory = SSLServerSocketFactory.getDefault();
                    serverSocket = factory.createServerSocket(port, backlog, address);
                    final String[] enabledCipherSuites = { "SSL_DH_anon_WITH_RC4_128_MD5" };
                    ((SSLServerSocket) serverSocket).setEnabledCipherSuites(enabledCipherSuites);
                } else {
                    serverSocket = new ServerSocket(port, backlog, address);
                }
View Full Code Here

Examples of javax.net.ServerSocketFactory

            next.start();

            ServerSocket serverSocket;
            try {
                if (secure) {
                    ServerSocketFactory factory = SSLServerSocketFactory.getDefault();
                    serverSocket = factory.createServerSocket(port, backlog, inetAddress);
                    final String[] enabledCipherSuites = { "SSL_DH_anon_WITH_RC4_128_MD5" };
                    ((SSLServerSocket) serverSocket).setEnabledCipherSuites(enabledCipherSuites);
                } else {
                    serverSocket = new ServerSocket(port, backlog, inetAddress);
                }
View Full Code Here

Examples of javax.net.ServerSocketFactory

    try
      {
  if (_server)
    {
      // Get a server socket
      ServerSocketFactory ssf = ServerSocketFactory.getDefault ();
      ServerSocket ss = ssf.createServerSocket (_port, 1);
      _socket = ss.accept ();
    }
  else
    {
      // Get a client socket (the factory will connect it)
View Full Code Here

Examples of javax.net.ServerSocketFactory

  
   protected ServerSocketFactory createServerSocketFactory()
   throws NoSuchAlgorithmException, KeyManagementException, IOException,
   CertificateException, UnrecoverableKeyException, KeyStoreException
   {
      ServerSocketFactory serverSocketFactory = null;
     
      SSLSocketBuilder server = new SSLSocketBuilder();
      server.setUseSSLServerSocketFactory(false);
     
      server.setSecureSocketProtocol("SSL");
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.