Changed whole procedure to more OO approach. Made easy to understand.
Cleared old connectionEstablished() method. Added new simple main method so that the client can run by itself.
Added simple run() method call to initiate the server.
Changes according to their source files.