docs: @Override
      public List<Message> getNextMessagesToDeliver() throws InterruptedException {
          LinkedList<Message> toDeliver = new LinkedList<>();
          synchronized (deliverySet) {
              while (deliverySet.isEmpty() || !deliverySet.first().isReadyToDeliver()) {
                  deliverySet.wait();
              }
  
              Iterator<MessageInfo> iterator = deliverySet.iterator();
  
              while (iterator.hasNext()) {
                  MessageInfo messageInfo = iterator.next();
                  if (messageInfo.isReadyToDeliver()) {
                      toDeliver.add(messageInfo.getMessage());
                      iterator.remove();
                  } else {
                      break;
                  }
              }
          }
          return toDeliver;
      }