- int msgLength = msgFactory.put(this.msg).length;
- int chunkCount = msgLength / NetconfMessageFactory.MAX_CHUNK_SIZE;
- if ((msgLength % NetconfMessageFactory.MAX_CHUNK_SIZE) != 0) {
+ final NetconfMessageToXMLEncoder enc = new NetconfMessageToXMLEncoder();
+ final ByteBuf out = Unpooled.buffer();
+ enc.encode(null, msg, out);
+ int msgLength = out.readableBytes();
+
+ int chunkCount = msgLength / ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE;
+ if ((msgLength % ChunkedFramingMechanismEncoder.DEFAULT_CHUNK_SIZE) != 0) {