private void handleMessage(Message msg) {

		Thread processThread = new Thread() {

			Message msg = null;

			public void run() {
				Message responseMsg = null;

				try {
					switch (msg.getType()) {

					case Protocol.REGISTER:
						responseMsg = process((RegisterRequest) msg);
						break;

					case Protocol.DEREGISTER:
						responseMsg = process((Deregister) msg);
						break;

					case Protocol.TASK_COMPLETE:
						responseMsg = process((TaskComplete) msg);
						break;

					case Protocol.TASK_SUMMARY_RES:
						responseMsg = process((TaskSummaryResponse) msg);
						break;

					default:
						break;
					}

					if (responseMsg != null) {
						Socket socket = new Socket(msg.getIPAddress(), msg.getPort());
						TCPSender tcpSender = new TCPSender(socket);
						tcpSender.sendData(responseMsg.marshal());
						if (socket != null) {
							try {
								socket.close();
							} catch (IOException e) {
								// Eat it.
							}
						}
					}
				} catch (UnknownHostException he) {
					he.printStackTrace();
				} catch (IOException e) {
					e.printStackTrace();
				}
			}

			Thread initialize(Message msg) {
				this.msg = msg;
				return this;
			}
		}.initialize(msg);

		processThread.start();

	}