@Test
public void getBuffer() {

    byte[] existing = KryoSerializers.getBuffer(1024);
    int size = existing.length * 41;
    byte[] b = KryoSerializers.getBuffer(size);
    assertEquals(size, b.length);
    byte[] bSame = KryoSerializers.getBuffer(size);
    assertTrue(b.hashCode() == bSame.hashCode());
    byte[] bLarger = KryoSerializers.getBuffer(size * 2);
    assertTrue(b.hashCode() != bLarger.hashCode());
    byte[] veryLarge = KryoSerializers
            .getBuffer((int) KryoSerializers.THREAD_LOCAL_BUFFER_LIMIT_BYTES * 2);
    // make sure buffer was not cached
    byte[] veryLargeSecond = KryoSerializers
            .getBuffer((int) KryoSerializers.THREAD_LOCAL_BUFFER_LIMIT_BYTES * 2);
    assertTrue(veryLarge.hashCode() != veryLargeSecond.hashCode());
}