@Override
	public void run() {
		callback.log("Connection accepted");
		try {
			out = new ObjectOutputStream(socket.getOutputStream());
			in = new ObjectInputStream(socket.getInputStream());

			while(true){
				Envelope m = null;
				//read in a evenlope.
				m = (Envelope)in.readObject();
				if(m == null){
					break;
				}
				/*
				 * Special commands.
				 */
				if(m.sender() != null && m.message().equals("Initial Connection."))
				{	
					name = m.sender();
					
					callback.send(new Envelope("Server","Join.",callback.getUsers()));
				}
				else if(m.sender() != null && m.message().equals("Leave."))
				{
					callback.send(new Envelope(name,"Leave.",callback.getUsers()));
					close();
					return;
				}
				/**
				 * If it isn't a special command send it to the other clients.
				 */
				callback.send(m);
			}

		} catch (IOException e) {
			e.printStackTrace();
		} catch (ClassNotFoundException e) {
			e.printStackTrace();
		}

	}