Fix SnappyFramedEncoderTest & SnappyFramedEncoder

- chunkLength is 3 bytes
This commit is contained in:
Trustin Lee 2013-02-10 00:03:47 +09:00
parent 3268781607
commit 8bd7ea2f93
2 changed files with 8 additions and 7 deletions

View File

@ -102,6 +102,7 @@ public class SnappyFramedEncoder extends ByteToByteEncoder {
private static void writeChunkLength(ByteBuf out, int chunkLength) {
out.writeByte(chunkLength & 0xff);
out.writeByte(chunkLength >>> 8 & 0xff);
out.writeByte(chunkLength >>> 16 & 0xff);
}
/**

View File

@ -41,8 +41,8 @@ public class SnappyFramedEncoderTest {
assertTrue(channel.finish());
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
-0x80, 0x06, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
0x01, 0x05, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y'
-0x80, 0x06, 0x00, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
0x01, 0x09, 0x00, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y'
});
assertEquals(expected, channel.readOutbound());
}
@ -58,8 +58,8 @@ public class SnappyFramedEncoderTest {
assertTrue(channel.finish());
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
-0x80, 0x06, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
0x00, 0x14, 0x00, 0x7b, 0x1f, 0x65, 0x64,
-0x80, 0x06, 0x00, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
0x00, 0x0E, 0x00, 0x00, 0x7b, 0x1f, 0x65, 0x64,
0x14, 0x10,
'n', 'e', 't', 't', 'y',
0x3a, 0x05, 0x00
@ -79,9 +79,9 @@ public class SnappyFramedEncoderTest {
assertTrue(channel.finish());
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
-0x80, 0x06, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
0x01, 0x05, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y',
0x01, 0x05, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y',
-0x80, 0x06, 0x00, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
0x01, 0x09, 0x00, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y',
0x01, 0x09, 0x00, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y',
});
assertEquals(expected, channel.readOutbound());
}