### Question:
ClientBuffer { public ListenableFuture<BufferResult> getPages(long sequenceId, DataSize maxSize) { return getPages(sequenceId, maxSize, Optional.empty()); } ClientBuffer(String taskInstanceId, OutputBufferId bufferId); BufferInfo getInfo(); boolean isDestroyed(); void destroy(); void enqueuePages(Collection<SerializedPageReference> pages); ListenableFuture<BufferResult> getPages(long sequenceId, DataSize maxSize); ListenableFuture<BufferResult> getPages(long sequenceId, DataSize maxSize, Optional<PagesSupplier> pagesSupplier); void setNoMorePages(); void loadPagesIfNecessary(PagesSupplier pagesSupplier); void acknowledgePages(long sequenceId); @Override String toString();  }### Answer:
@Test public void testDuplicateRequests() { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); for (int i = 0; i < 3; i++) { addPage(buffer, createPage(i)); } assertBufferInfo(buffer, 3, 0); assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), bufferResult(0, createPage(0), createPage(1), createPage(2))); assertBufferInfo(buffer, 3, 0); assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), bufferResult(0, createPage(0), createPage(1), createPage(2))); assertBufferInfo(buffer, 3, 0); buffer.getPages(3, sizeOfPages(10)).cancel(true); assertBufferResultEquals(TYPES, getBufferResult(buffer, 0, sizeOfPages(10), NO_WAIT), emptyResults(TASK_INSTANCE_ID, 0, false)); assertBufferInfo(buffer, 0, 3); }
@Test public void testInvalidTokenFails() { ClientBuffer buffer = new ClientBuffer(TASK_INSTANCE_ID, BUFFER_ID); addPage(buffer, createPage(0)); addPage(buffer, createPage(1)); buffer.getPages(1, sizeOfPages(10)).cancel(true); assertBufferInfo(buffer, 1, 1); assertInvalidSequenceId(buffer, -1); assertBufferInfo(buffer, 1, 1); assertInvalidSequenceId(buffer, 10); assertBufferInfo(buffer, 1, 1); }