Example usage for io.netty.buffer CompositeByteBuf readByte

List of usage examples for io.netty.buffer CompositeByteBuf readByte

Introduction

In this page you can find the example usage for io.netty.buffer CompositeByteBuf readByte.

Prototype

@Override
    public byte readByte() 

Source Link

Usage

From source file:io.grpc.alts.internal.BufUnwrapperTest.java

License:Apache License

@Test
public void writableNioBuffers_worksWithComposite() {
    CompositeByteBuf buf = alloc.compositeBuffer();
    buf.addComponent(alloc.buffer(1));/*w w  w  .  ja v a 2 s . c  om*/
    buf.capacity(1);
    try (BufUnwrapper unwrapper = new BufUnwrapper()) {
        ByteBuffer[] internalBufs = unwrapper.writableNioBuffers(buf);
        Truth.assertThat(internalBufs).hasLength(1);

        internalBufs[0].put((byte) 'a');

        buf.writerIndex(1);
        assertEquals('a', buf.readByte());
    } finally {
        buf.release();
    }
}