ksu.cis.mom
Class SecureUnicastHandler

java.lang.Object
  extended byjava.lang.Thread
      extended byksu.cis.mom.SecureUnicastHandler
All Implemented Interfaces:
Runnable

public class SecureUnicastHandler
extends Thread

The SecureUnicastHandler class is used to handle secured unicast connection from other agents. It uses the Secure Socket Layers (SSLSocket class) and Secure Socket Layers Server Socket (SSLServerSocket class) to establish a secured connection over TCP/IP stream. When an agent is created, it can create a new secured unicast handler thread to be able to receive a start of secured unicast conversation from the other agents. Below is how an agent can start the SecureUnicastHandler class.

 SecureUnicastHandler suh = new SecureUnicastHandler(this.port, this);
 suh.start();
 

To create the SecureUnicastHandler, it requires two parameters, port number and a reference to parent agent object. When it is started, the secured unicast handler starts a ssl socket server on the indicated port and waits for a connection from another agent. When a connection is received, the SecureUnicastHandler simply accepts and calls the parent agent’s receiveMessage method with the connection ssl socket and the input and output streams. The agent then verify the received message and start an appropriate conversation.

History:
08/13/2003: created date
09/02/2003: Add more comments suitable for JavaDoc.

Since:
agentMom 1.2.1

Field Summary
 Agent parent
          Reference to parent agent object that use this SecureUnicastHandler class.
 int portNo
          Port number that the SecureUnicastHandler listens for secured unicast conversation.
 SSLServerSocket sslServer
          SSLServerSocket class used for accepting/constructing secured unicast conversation.
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SecureUnicastHandler(int port, Agent p)
          SecureUnicastHandler Constructor
 
Method Summary
 void run()
          Run method for SecureMulticastHandler.
 void setAlive(boolean alive)
          Set value for isAlive.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

portNo

public int portNo
Port number that the SecureUnicastHandler listens for secured unicast conversation.


sslServer

public SSLServerSocket sslServer
SSLServerSocket class used for accepting/constructing secured unicast conversation.


parent

public Agent parent
Reference to parent agent object that use this SecureUnicastHandler class.

Constructor Detail

SecureUnicastHandler

public SecureUnicastHandler(int port,
                            Agent p)
SecureUnicastHandler Constructor

Parameters:
port - - Integer port number
p - - Reference to parent agent object that use this class.
Method Detail

run

public void run()

Run method for SecureMulticastHandler. This method listens for a connection starting a new secured unicast conversation from other agents. Then, initialize input and output streams, and call the parent agent's receiveSecureUnicastConversation method. Finally, the connection, input stream and output stream is passed to the parent agent's receiveMessage message.

See Also:
Runnable.run()

setAlive

public void setAlive(boolean alive)
Set value for isAlive.

Parameters:
alive - - if value is false will make the BroadcastHandler thread to stop the next time this value is checked.