Advanced Java
3 credits
Comments placed in the source code file | 5 |
Application placed in an executable JAR file | 5 |
Client GUI created | 5 |
Client can send secured data to server | 15 |
Client can receive secured data from server | 15 |
Server can send secured data to (multiple) clients | 15 |
Server can receive secured data from (multiple) clients | 15 |
JavaBeans used with bound properties and listener | 20 |
Usernames are collected and used | 5 |
Total | 100 pts |
To use the JSSE extension to perform secure network communications
For this lab you will create a secure multithreaded chat application. The application will be composed of two parts: a client and a server. The server will be primarily responsible for accepting incoming connections from clients and producing objects to handle the clients once they are connected. The client will be a GUI application that will allow a user to participate in an online chat, posting messages to the server, and seeing messages posted by other clients.
The server itself should be composed of three classes. The first will be the SecureChatServer class which will accept incoming connections from clients on port 7070 and will in response create a ClientHandler object (the second needed class) to receive incoming data from the client. The ClientHandler class should operate on its own thread so that it will not interfere with other clients connecting to the server. The third class needed on the server will be a JavaBean called ChatBean which will store data sent from any client. The property that stores the data from clients should be bound and every ClientHandler should be registered as a listener for this class so that every time a piece of data is received from a client all ClientHandlers will be notified and will send the new data to each client (every client receives every message).
The client will be made up of two classes. The first will be the SecureChatClient class which will create the GUI for the client to use, will handle events from the GUI, and will initiate communications with the server. The second client class will be a ServerListener which will operate on its own thread as it will need to continuously listen for data being sent from the server without interfering with the operation of the clients GUI. The ServerListener should be written as a JavaBean with a bound property in which will be stored any data coming from the server. The SecureChatClient will be a property listener for this property so that every time a new piece of data is received from the server by the ServerListener it will fire and event which the SecureChatClient will then be notified of so that it can then post that new information in a textarea.
The flow of the system should go like this:
All communications traveling between the client and the server should be over SSL connections, providing secure communications.
Every user chatting on the system should be able to supply a username which should then be displayed to all clients with every message they send. The client should also include a Close button which will terminate that clients communications with the server in a way that does not crash the server (or client I hope) so that users may close their own clients leaving the server available for others to continue using.
The server does not require an interface of any type but output to the command line will certainly help with debugging.