}
@Override
public void run() {
while (true) {
Message mesIn = null;
try {
mesIn = (Message) objectIS.readObject();
}
catch (IOException e) {
cHandler.disconnect();
return;
}
catch (ClassNotFoundException e) {
e.printStackTrace();
}
Message mesOut = null;
if (mesIn instanceof ChangeNickMessage) {
String oldnickname = cHandler.nickname;
cHandler.nickname = ((ChangeNickMessage) mesIn).name;
mesOut = new StatusMessage(oldnickname + "is now known as "
+ cHandler.nickname);