@Test public void handle() { Consumer.ConsumerPolicy consumerPolicy = new Consumer.ConsumerPolicy(); consumerPolicy.setDelay(1); List<ByteBuffer> byteBufferList = new LinkedList<>(); ByteBuffer allocate = ByteBuffer.allocate(100); allocate.position(39); allocate.putLong(SystemClock.now() - 1000); allocate.flip(); ByteBuffer allocate2 = ByteBuffer.allocate(100); allocate2.position(39); allocate2.putLong(SystemClock.now() + 1000); allocate2.flip(); byteBufferList.add(allocate); byteBufferList.add(allocate2); List<ByteBuffer> handle = delayHandler.handle(consumerPolicy, byteBufferList); Assert.assertEquals(1, handle.size()); }
public List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList) { if (needDelay(consumerPolicy)) { return filterLayerMsg(consumerPolicy, byteBufferList); } return byteBufferList; }
DelayHandler { public List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList) { if (needDelay(consumerPolicy)) { return filterLayerMsg(consumerPolicy, byteBufferList); } return byteBufferList; } }
DelayHandler { public List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList) { if (needDelay(consumerPolicy)) { return filterLayerMsg(consumerPolicy, byteBufferList); } return byteBufferList; }  }
DelayHandler { public List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList) { if (needDelay(consumerPolicy)) { return filterLayerMsg(consumerPolicy, byteBufferList); } return byteBufferList; }  List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList); boolean needDelay(Consumer.ConsumerPolicy consumerPolicy); }
DelayHandler { public List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList) { if (needDelay(consumerPolicy)) { return filterLayerMsg(consumerPolicy, byteBufferList); } return byteBufferList; }  List<ByteBuffer> handle(Consumer.ConsumerPolicy consumerPolicy, List<ByteBuffer> byteBufferList); boolean needDelay(Consumer.ConsumerPolicy consumerPolicy);  }