// Earliest offset
sock.sendMore("OFFSET");
sock.send(ByteBuffer.allocate(8).putLong(-2).array());
Msg status = sock.base().recv(0);
assertTrue(status.hasMore());
assertEquals(100, status.data()[0]);
Msg oldest = sock.base().recv(0);
assertFalse(oldest.hasMore());
assertEquals(infos[0].start(), oldest.buf().getLong());
// Latest offset
sock.sendMore("OFFSET");
sock.send(ByteBuffer.allocate(8).putLong(-1).array());
status = sock.base().recv(0);
assertTrue(status.hasMore());
assertEquals(100, status.data()[0]);
Msg latest = sock.base().recv(0);
assertTrue(latest.hasMore());
assertEquals(infos[infos.length - 1].start(), latest.buf().getLong());
Msg last = sock.base().recv(0);
assertFalse(last.hasMore());
assertEquals(infos[infos.length - 1].offset(), last.buf().getLong());
// Modified before
sock.sendMore("OFFSET");
sock.send(ByteBuffer.allocate(8).putLong(System.currentTimeMillis()).array());
status = sock.base().recv(0);
assertTrue(status.hasMore());
assertEquals(100, status.data()[0]);
List<Long> offsetList = new ArrayList<Long>();
while (true) {
Msg msg = sock.base().recv(0);
offsetList.add(msg.buf().getLong());
if (!msg.hasMore())
break;
}
assertEquals(infos.length + 1, offsetList.size());
for (int i = 0; i < infos.length; i++) {
assertEquals(infos[i].start(), (long) offsetList.get(i));