private void handleInput(SelectionKey key) throws IOException {
		if (key.isValid()) {
			// 处理新接入的请求
			if (key.isAcceptable()) {
				ServerSocketChannel ssc = (ServerSocketChannel) key.channel();
				SocketChannel sc = ssc.accept();
				sc.configureBlocking(false);
				sc.register(selector, SelectionKey.OP_READ);
			}
			if (key.isReadable()) {
				SocketChannel ssc = (SocketChannel) key.channel();
				ByteBuffer readBuffer = ByteBuffer.allocate(1024);
				int readBytes = ssc.read(readBuffer);
				if (readBytes > 0) {
					readBuffer.flip();	// 准备从缓冲区中读取数据时调用,将limit设置为position,position设置为0
					byte[] bytes = new byte[readBuffer.remaining()];
					readBuffer.get(bytes);
					String body = new String(bytes, "utf-8");
					System.out.println("接收到客户端的数据: " + body);
					String currentTime = "QUERY TIME".equalsIgnoreCase(body) ? new Date(
							System.currentTimeMillis()).toString()
							: "BAD ORDER";
					doWrite(ssc, currentTime);
				} else if (readBytes < 0) {
					// 对端链路关闭
					key.cancel();
					ssc.close();
				} else {

				}
			}
		}
	}