Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * JBoss, Home of Professional Open Source
   */
  package org.jboss.remoting.security;
  
 
SSL server socket factory whose configuration is customized.

Author(s):
John Mazzitelli
Version:
$Revision: 3839 $
 
    extends SSLServerSocketFactory
 {
    private SSLSocketBuilderMBean       theBuilder;

   
Constructor for CustomSSLServerSocketFactory. The factory can be null - call setFactory(javax.net.ssl.SSLServerSocketFactory) to set it later.

Parameters:
factory the true factory this class delegates to
builder the class that built this custom factory - contains all the configuration for this factory
 
                                         SSLSocketBuilderMBean       builder )
    {
       super();
         = builder;
        = factory;
    }
 
    {
 
    }

   
Sets the builder that creates the true socket server factory.

Parameters:
sslSocketBuilder
 
    public void setSSLSocketBuilder(SSLSocketBuilderMBean sslSocketBuilder)
    {
       this. = sslSocketBuilder;
    }

   
Returns the builder that created this factory. You can obtain the configuration of this factory by examining the returned object's configuration.

Returns:
the builder
 
    {
       return ;
    }

   
Sets a new factory in this object - this is the factory that this object will use to create new sockets.

Parameters:
factory the new factory
Throws:
java.lang.IllegalArgumentException if factory is null
 
    public void setFactorySSLServerSocketFactory factory )
    {
       if ( factory == null )
       {
          throw new IllegalArgumentException"Factory cannot be null" );
       }
 
        = factory;
    }

   
 
    throws IOException
    {
       setSocketModessock );
       return sock;
    }

   
 
    public ServerSocket createServerSocketint port )
    throws IOException
   {
      setSocketModessock );
      return sock;
   }

   
   public ServerSocket createServerSocketint port,
                                           int backlog )
   throws IOException
   {
      SSLServerSocket sock = (SSLServerSocket.createServerSocketportbacklog );
      setSocketModessock );
      return sock;
   }

   
   public ServerSocket createServerSocketint         port,
                                           int         backlog,
                                           InetAddress ifAddress )
   throws IOException
   {
      SSLServerSocket sock = (SSLServerSocket.createServerSocketportbacklogifAddress );
      setSocketModessock );
      return sock;
   }

   
   {
      return .getDefaultCipherSuites();
   }

   
   {
   }

   
   public boolean equalsObject obj )
   {
      return .equalsobj );
   }

   
   public int hashCode()
   {
      return .hashCode();
   }

   
   public String toString()
   {
      return .toString();
   }

   
Sets the socket modes according to the custom configuration.

Parameters:
sock the socket whose modes are to be set
   private void setSocketModesSSLServerSocket sock )
   {
      if (  != null )
      {
         
         boolean isServerSocketUseClientMode = ((Boolean)AccessController.doPrivilegednew PrivilegedAction()
         {
            public Object run()
            {
               return new Boolean(.isServerSocketUseClientMode());
            }
         })).booleanValue();
         
         boolean isClientAuthModeWant = ((Boolean)AccessController.doPrivilegednew PrivilegedAction()
         {
            public Object run()
            {
               return new Boolean(.isClientAuthModeWant());
            }
         })).booleanValue();
         
         boolean isClientAuthModeNeed = ((Boolean)AccessController.doPrivilegednew PrivilegedAction()
         {
            public Object run()
            {
               return new Boolean(.isClientAuthModeNeed());
            }
         })).booleanValue();
         sock.setUseClientModeisServerSocketUseClientMode );
         
         if ( isClientAuthModeWant )
         {
            sock.setNeedClientAuthfalse );
            sock.setWantClientAuthtrue );
         }
         else if ( isClientAuthModeNeed )
         {
            sock.setWantClientAuthfalse );
            sock.setNeedClientAuthtrue );
         }
         else
         {
            sock.setWantClientAuthfalse );
            sock.setNeedClientAuthfalse );
         }
      }
      return;
   }
New to GrepCode? Check out our FAQ X