Assert.assertEquals(content, aggregate);
}
private List<DataFrame> testGenerateParse(ByteBuffer data)
{
DataGenerator generator = new DataGenerator(new HeaderGenerator());
final List<DataFrame> frames = new ArrayList<>();
Parser parser = new Parser(byteBufferPool, new Parser.Listener.Adapter()
{
@Override
public boolean onData(DataFrame frame)
{
frames.add(frame);
return false;
}
}, 4096, 8192);
// 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.generateData(lease, 13, data.slice(), true, data.remaining());
frames.clear();
for (ByteBuffer buffer : lease.getByteBuffers())
{
parser.parse(buffer);