Use correct writerIndex when read for channel