ByteBuffer writeBuffer = generator.control(new SynReplyFrame(SPDY.V2, (byte)0, streamId, new Fields()));
channel.write(writeBuffer);
assertThat("SynReply is fully written", writeBuffer.hasRemaining(), is(false));
byte[] bytes = new byte[1];
writeBuffer = generator.data(streamId, bytes.length, new BytesDataInfo(bytes, true));
channel.write(writeBuffer);
assertThat("data is fully written", writeBuffer.hasRemaining(), is(false));
// Write again to simulate the faulty condition
writeBuffer.flip();