com.cafesoft.core.message
Class DefaultSocketFactory

java.lang.Object
  |
  +--com.cafesoft.core.message.DefaultSocketFactory
All Implemented Interfaces:
SocketFactory

public class DefaultSocketFactory
extends Object
implements SocketFactory

DefaultSocketFactory implements a singleton factory for creating Socket instances.

Note: The SocketFactory interface is already designed to handle SSL socket exceptions.

Since:
1/31/02

Constructor Summary
DefaultSocketFactory()
          Create a new DefaultSocketFactory.
 
Method Summary
 Socket createSocket(InetAddress address, int port)
          Returns a socket which uses the specified network interface to the remote host, and is bound to a the specified port.
 void initialize(Properties prop)
          Initialize the SocketFactory.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultSocketFactory

public DefaultSocketFactory()
Create a new DefaultSocketFactory.

Method Detail

initialize

public void initialize(Properties prop)
                throws SocketFactoryException
Initialize the SocketFactory.

Specified by:
initialize in interface SocketFactory
Parameters:
prop - properties used to initialize the SocketFactory.
Throws:
SocketFactoryException - if required configuration properties are missing or invalid.

createSocket

public Socket createSocket(InetAddress address,
                           int port)
                    throws IOException,
                           KeyStoreException,
                           NoSuchAlgorithmException,
                           CertificateException,
                           UnrecoverableKeyException,
                           KeyManagementException
Returns a socket which uses the specified network interface to the remote host, and is bound to a the specified port. The socket is configured with the socket options given to this factory.

Specified by:
createSocket in interface SocketFactory
Parameters:
address - the network interface address to use
port - the port to listen to
Returns:
a new socket for the specified address and port
Throws:
IOException - input/output or network error
KeyStoreException - error instantiating the KeyStore from file (SSL only)
NoSuchAlgorithmException - KeyStore algorithm unsupported by current provider (SSL only)
CertificateException - general certificate error (SSL only)
UnrecoverableKeyException - internal KeyStore problem with the certificate (SSL only)
KeyManagementException - problem in the key management layer (SSL only)


Generated on 10:40:31 AM September 10, 2003, © 1996-2003 Cafésoft LLC. All rights reserved.