List of usage examples for io.netty.channel DefaultAddressedEnvelope content
@Override
public M content()
From source file:org.restcomm.media.control.mgcp.network.netty.MgcpMessageEncoder.java
License:Open Source License
@Override protected void encode(ChannelHandlerContext ctx, DefaultAddressedEnvelope<MgcpMessage, SocketAddress> msg, List<Object> out) throws Exception { final InetSocketAddress sender = (InetSocketAddress) msg.sender(); final InetSocketAddress recipient = (InetSocketAddress) msg.recipient(); final byte[] content = msg.content().toString().getBytes(); final ByteBuf buffer = Unpooled.buffer(content.length).writeBytes(content); final DatagramPacket packet = new DatagramPacket(buffer, recipient, sender); if (log.isDebugEnabled()) { log.debug("Sending outgoing message to " + recipient.getHostString() + "\n" + msg.toString()); }/*from w ww .j ava2s . com*/ out.add(packet); }