mirror of
https://github.com/Minestom/Minestom.git
synced 2024-11-08 03:40:27 +01:00
Ensure proper buffer caching
This commit is contained in:
parent
e169b631d5
commit
75b54e6302
@ -35,8 +35,11 @@ public class SendablePacketTest {
|
|||||||
assertSame(packet, cached.packet());
|
assertSame(packet, cached.packet());
|
||||||
|
|
||||||
var buffer = PacketUtils.allocateTrimmedPacket(packet);
|
var buffer = PacketUtils.allocateTrimmedPacket(packet);
|
||||||
assertEquals(buffer.body(), cached.body());
|
var cachedBuffer = cached.body();
|
||||||
assertEquals(buffer.body(), cached.body());
|
assertEquals(buffer.body(), cachedBuffer);
|
||||||
|
// May fail in the very unlikely case where soft references are cleared
|
||||||
|
// Rare enough to make this test worth it
|
||||||
|
assertSame(cached.body(), cachedBuffer);
|
||||||
|
|
||||||
assertSame(packet, cached.packet());
|
assertSame(packet, cached.packet());
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user