/**
* Class representing sending message event
- *
+ *
* @author michal.polkorab
*/
public class SendEvent implements ClientEvent {
* @param msgToSend message to be sent
*/
public SendEvent(byte[] msgToSend) {
- this.msgToSend = msgToSend;
+ this.msgToSend = new byte[msgToSend.length];
+ for (int i = 0; i < msgToSend.length; i++) {
+ this.msgToSend[i] = msgToSend[i];
+ }
}
@Override
ByteBuf buffer = ctx.alloc().buffer();
buffer.writeBytes(msgToSend);
ctx.writeAndFlush(buffer);
- LOGGER.debug(">> " + ByteBufUtils.bytesToHexString(msgToSend));
- LOGGER.debug("message sent");
+
+ if (LOGGER.isDebugEnabled()) {
+ LOGGER.debug(">> {}", ByteBufUtils.bytesToHexString(msgToSend));
+ LOGGER.debug("message sent");
+ }
return true;
}