//根据不同的异常类型,来设置客户端的状态
if(exception instanceof TransferException) { //网络错误
logger.fatal("Connection error. Please try to login again after several time.");
this.state = ClientState.CONNECTION_ERROR;
}else if(exception instanceof RegistrationException) { //注册异常
RegistrationException re = (RegistrationException) exception;
if(re.getRegistrationType()==RegistrationException.DEREGISTERED) {
logger.fatal("You have logined by other client.");
this.state = ClientState.OTHER_LOGIN; //用户其他地方登陆
}else if(re.getRegistrationType()==RegistrationException.DISCONNECTED) {
logger.fatal("Server has closed connection. Please try to login again after several time.");
this.state = ClientState.DISCONNECTED; //服务器关闭了连接
}else {
logger.fatal("Unknown registration exception", exception);
}