code: public void deleteMessages(List<String> nodes) throws NoResponseException, XMPPErrorException, NotConnectedException, InterruptedException {
          OfflineMessageRequest request = new OfflineMessageRequest();
          request.setType(IQ.Type.set);
          for (String node : nodes) {
              OfflineMessageRequest.Item item = new OfflineMessageRequest.Item(node);
              item.setAction("remove");
              request.addItem(item);
          }
          connection.createStanzaCollectorAndSend(request).nextResultOrThrow();
      }
docs: Deletes the specified list of offline messages. The request will include the list of
  stamps that uniquely identifies the offline messages to delete.
  
  @param nodes the list of stamps that uniquely identifies 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