de.karb.hitcryptoproxy
Class ClientWorker

java.lang.Object
  extended by de.karb.hitcryptoproxy.ClientWorker
All Implemented Interfaces:
java.lang.Runnable

public class ClientWorker
extends java.lang.Object
implements java.lang.Runnable

Class for reading and encoding a command from the client and reading and decoding the answer from the server. This class implements Runnable. Its instances are started in a thread, whenever one of the server sockets of HitCryptoProxyServer accepts a connection.

Author:
Schildmann@karb.de

Constructor Summary
ClientWorker(Configuration.Mode mode, java.net.Socket clientSocket, Configuration config, java.util.Random randomGenerator, org.apache.log4j.Logger logger)
          Constructor of the runnable ClientWorker
 
Method Summary
 void finalize()
           
 void run()
          This method tries to connect to the server, then reads and encodes the command from the client and reads and decodes an answer from the server.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientWorker

public ClientWorker(Configuration.Mode mode,
                    java.net.Socket clientSocket,
                    Configuration config,
                    java.util.Random randomGenerator,
                    org.apache.log4j.Logger logger)
             throws java.io.IOException
Constructor of the runnable ClientWorker

Parameters:
mode - the mode production or test
clientSocket - the client socket
config - the configuration
randomGenerator - reuse of randomGenerator is always wise
logger - the logger
Throws:
java.io.IOException
Method Detail

run

public void run()
This method tries to connect to the server, then reads and encodes the command from the client and reads and decodes an answer from the server. When ClientWorker is used to create a thread, starting the thread causes this method to be called in that separately executing thread.

Specified by:
run in interface java.lang.Runnable
See Also:
Runnable.run()

finalize

public void finalize()
              throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
Throws:
java.lang.Throwable
See Also:
Object.finalize()