@Override
	public void run() {
		String responseStr = null;
		String strInputMesg = null;
		POP3CommandHandler ch = null;

		// 初始化pop3 session
		initSession();
		// pop3服务线程正常启动
		sendResponse("+OK pop3 server is ready");
		getLogger().info("pop3:建立一个连接" + "(" + pop3ID + "/" + remoteHost + "/" + remoteIP + ")");

		// 循环等待命令
		while (!sessionEnded) {
			// 读取一行数据
			strInputMesg = getCommand(in, connectLostTime);

			if (strInputMesg == null) {
				// 超时没有读取命令，断开连接
				getLogger().info("pop3:超时读取客户端命令");
				sessionEnded = true;
				// 如果用户被锁定，则解锁
				if (null != user && userListManager.isUserLocked(user.getUserName(), LockType.POP3)) {
					userListManager.unlockUser(user.getUserName(), LockType.POP3);
				}
				break;
			}

			// 检查命令格式
			if (checkCommandValid(strInputMesg)) {
				// 正确
				ch = POP3DealCommand.getCommandHandler(commandList[0]);
				if (ch == null) {
					// 非法命令
					responseStr = "-ERR unknown command";
					sendResponse(responseStr);
					getLogger().info(responseStr);
				} else {
					try {
						ch.onCommand(this, commandList[1], commandList[2]);
					} catch (POP3Exception e) {
						System.out.println("通过exception发送一条错误信息");
						sendResponse(e.getErrorMsg());
					}
				}
			} else {
				// 不正确
				sendResponse("-ERR unknown command");
			}
		}
		if (user != null) {
			getLogger().info("pop3: ID:" + pop3ID + "  user:" + user.getUserName() + "断开连接");
		}

		clearSession();
	}