code: public List<OfflineMessageHeader> getHeaders() throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
          List<OfflineMessageHeader> answer = new ArrayList<>();
          DiscoverItems items = ServiceDiscoveryManager.getInstanceFor(connection).discoverItems(
                  null, namespace);
          for (DiscoverItems.Item item : items.getItems()) {
              answer.add(new OfflineMessageHeader(item));
          }
          return answer;
      }
docs: Returns a List of <tt>OfflineMessageHeader</tt> that keep information about the
  offline message. The OfflineMessageHeader includes a stamp that could be used to retrieve
  the complete message or delete the specific message.
  
  @return a List of <tt>OfflineMessageHeader</tt> that keep information about the offline
  message.
  @throws XMPPErrorException If the user is not allowed to make this request or the server does
  not support offline message retrieval.
  @throws NoResponseException if there was no response from the server.
  @throws NotConnectedException
  @throws InterruptedException