@Override
protected Object safeObject(Object msg, ByteBufAllocator allocator) throws Exception {
if (msg instanceof DatagramPacket) {
DatagramPacket packet = (DatagramPacket) msg;
ByteBuf content = packet.content();
if (content.isDirect()) {
content = safeBuffer(content, allocator);
}
return new DatagramPacketImpl(packet.sender(), Buffer.buffer(content));
}