ocsftester
Class SimpleClient

java.lang.Object
  |
  +--ocsf.client.AbstractClient
        |
        +--ocsftester.SimpleClient

public class SimpleClient
extends AbstractClient

The SimpleClient class is a simple subclass of the ocsf.server.AbstractClient class. It allows testing of the functionalities offered by the OCSF framework. The java.awt.List instance is used to display informative messages. This list is pink when the connection has been closed, red when an exception is received, and green when connected to the server.

See Also:
AbstractServer

Field Summary
private  java.awt.List liste
           
 
Fields inherited from class ocsf.client.AbstractClient
clientReader, clientSocket, host, input, output, port, readyToStop
 
Constructor Summary
SimpleClient(int port, java.awt.List liste)
           
SimpleClient(java.awt.List liste)
           
SimpleClient(java.lang.String host, int port, java.awt.List liste)
           
 
Method Summary
protected  void connectionClosed()
          Hook method called after the connection has been closed.
protected  void connectionEstablished()
          Hook method called after a connection has been established.
protected  void connectionException(java.lang.Exception exception)
          Hook method called each time an exception is thrown by the client's thread that is waiting for messages from the server.
protected  void handleMessageFromServer(java.lang.Object msg)
          Handles a message sent from the server to this client.
 
Methods inherited from class ocsf.client.AbstractClient
closeAll, closeConnection, getHost, getInetAddress, getPort, isConnected, openConnection, run, sendToServer, setHost, setPort
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

liste

private java.awt.List liste
Constructor Detail

SimpleClient

public SimpleClient(java.awt.List liste)

SimpleClient

public SimpleClient(int port,
                    java.awt.List liste)

SimpleClient

public SimpleClient(java.lang.String host,
                    int port,
                    java.awt.List liste)
Method Detail

connectionClosed

protected void connectionClosed()
Hook method called after the connection has been closed.
Overrides:
connectionClosed in class AbstractClient

connectionException

protected void connectionException(java.lang.Exception exception)
Hook method called each time an exception is thrown by the client's thread that is waiting for messages from the server.
Parameters:
exception - the exception raised.
Overrides:
connectionException in class AbstractClient

connectionEstablished

protected void connectionEstablished()
Hook method called after a connection has been established.
Overrides:
connectionEstablished in class AbstractClient

handleMessageFromServer

protected void handleMessageFromServer(java.lang.Object msg)
Handles a message sent from the server to this client.
Parameters:
msg - the message sent.
Overrides:
handleMessageFromServer in class AbstractClient