List of usage examples for io.netty.channel DefaultAddressedEnvelope sender
A sender
To view the source code for io.netty.channel DefaultAddressedEnvelope sender.
Click Source Link
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()); }/* w w w . j a va 2 s .c om*/ out.add(packet); }