添加:

AttributeKey<String> key = AttributeKey.valueOf("sn");
ctx.channel().attr(key).set(deviceSn);

获取:

AttributeKey<String> key = AttributeKey.valueOf("sn");
String deviceSn = ctx.channel().attr(key).get();