int read=channel.read(buffer);
if(read>0){
byte[] data=buffer.array();
String msg=new String(data).trim();
System.out.println("recieved"+msg);
ByteBuffer outBuffer=ByteBuffer.wrap("好的".getBytes());
channel.write(outBuffer);
}else{
System.out.println("客户端关闭");
key.cancel();
}