private final ByteBufferPool byteBufferPool = new MappedByteBufferPool();
@Test
public void testGenerateParse() throws Exception
{
PriorityGenerator generator = new PriorityGenerator(new HeaderGenerator());
final List<PriorityFrame> frames = new ArrayList<>();
Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
{
@Override
public boolean onPriority(PriorityFrame frame)
{
frames.add(frame);
return false;
}
}, 4096, 8192);
int streamId = 13;
int dependentStreamId = 17;
int weight = 3;
boolean exclusive = true;
// Iterate a few times to be sure generator and parser are properly reset.
for (int i = 0; i < 2; ++i)
{
ByteBufferPool.Lease lease = new ByteBufferPool.Lease(byteBufferPool);
generator.generatePriority(lease, streamId, dependentStreamId, weight, exclusive);
frames.clear();
for (ByteBuffer buffer : lease.getByteBuffers())
{
while (buffer.hasRemaining())