//1.String ->Bytebuf
//把string text转换成Bytebuf
channel.writeAndFlush(Unpooled.copiedBuffer(text.getBytes());
//2.Object msg->String str
//readableBytes()长度,readIndex()起始位置
ByteBuf buf=null;
buf =(ByteBuf)msg;
byte[] bytes=new byte[buf.readableBytes()];//
buf.getBytes(buf.readIndex(),bytes);
String str=new String(bytes);