in method **writeToMessage** _bytesToCopy_ should be _remaining_: byteBuffer.get(this.sharedArray, this.offset + this.length, remaining); `this.length += remaining; return remaining;`