List of usage examples for io.netty.channel DefaultAddressedEnvelope toString
@Override
public String toString()
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 ww .j av a 2s . c om out.add(packet); }