for (;;) {
result = engine.wrap(EMPTY_BUFFER, outNetBuf);
if (result.bytesProduced() > 0) {
outNetBuf.flip();
ByteArray msg = new HeapByteArray(outNetBuf.remaining());
msg.set(msg.firstIndex(), outNetBuf.array(), 0, msg.length());
outNetBuf.clear();
if (channel.isConnected()) {
future = new DefaultChannelFuture(channel, false);
ChannelUtil.write(ctx, channel, future, msg);
}