Fix SnappyFramedEncoderTest & SnappyFramedEncoder
- chunkLength is 3 bytes
This commit is contained in:
parent
3268781607
commit
8bd7ea2f93
@ -102,6 +102,7 @@ public class SnappyFramedEncoder extends ByteToByteEncoder {
|
|||||||
private static void writeChunkLength(ByteBuf out, int chunkLength) {
|
private static void writeChunkLength(ByteBuf out, int chunkLength) {
|
||||||
out.writeByte(chunkLength & 0xff);
|
out.writeByte(chunkLength & 0xff);
|
||||||
out.writeByte(chunkLength >>> 8 & 0xff);
|
out.writeByte(chunkLength >>> 8 & 0xff);
|
||||||
|
out.writeByte(chunkLength >>> 16 & 0xff);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -41,8 +41,8 @@ public class SnappyFramedEncoderTest {
|
|||||||
assertTrue(channel.finish());
|
assertTrue(channel.finish());
|
||||||
|
|
||||||
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
|
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
|
||||||
-0x80, 0x06, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
|
-0x80, 0x06, 0x00, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
|
||||||
0x01, 0x05, 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());
|
assertEquals(expected, channel.readOutbound());
|
||||||
}
|
}
|
||||||
@ -58,8 +58,8 @@ public class SnappyFramedEncoderTest {
|
|||||||
assertTrue(channel.finish());
|
assertTrue(channel.finish());
|
||||||
|
|
||||||
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
|
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
|
||||||
-0x80, 0x06, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
|
-0x80, 0x06, 0x00, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
|
||||||
0x00, 0x14, 0x00, 0x7b, 0x1f, 0x65, 0x64,
|
0x00, 0x0E, 0x00, 0x00, 0x7b, 0x1f, 0x65, 0x64,
|
||||||
0x14, 0x10,
|
0x14, 0x10,
|
||||||
'n', 'e', 't', 't', 'y',
|
'n', 'e', 't', 't', 'y',
|
||||||
0x3a, 0x05, 0x00
|
0x3a, 0x05, 0x00
|
||||||
@ -79,9 +79,9 @@ public class SnappyFramedEncoderTest {
|
|||||||
assertTrue(channel.finish());
|
assertTrue(channel.finish());
|
||||||
|
|
||||||
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
|
ByteBuf expected = Unpooled.wrappedBuffer(new byte[] {
|
||||||
-0x80, 0x06, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
|
-0x80, 0x06, 0x00, 0x00, 0x73, 0x4e, 0x61, 0x50, 0x70, 0x59,
|
||||||
0x01, 0x05, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y',
|
0x01, 0x09, 0x00, 0x00, 0x2d, -0x5a, -0x7e, -0x5e, 'n', 'e', 't', 't', 'y',
|
||||||
0x01, 0x05, 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());
|
assertEquals(expected, channel.readOutbound());
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user