code: public static DomainBareJid getPubSubService(XMPPConnection connection)
                      throws NoResponseException, XMPPErrorException, NotConnectedException,
                      InterruptedException {
          return ServiceDiscoveryManager.getInstanceFor(connection).findService(PubSub.NAMESPACE,
                          true, "pubsub", "service");
      }
docs: Get the "default" PubSub service for a given XMPP connection. The default PubSub service is
  simply an arbitrary XMPP service with the PubSub feature and an identity of category "pubsub"
  and type "service".
  
  @param connection
  @return the default PubSub service or <code>null</code>.
  @throws NoResponseException
  @throws XMPPErrorException
  @throws NotConnectedException
  @throws InterruptedException
  @see <a href="http://xmpp.org/extensions/xep-0060.html#entity-features">XEP-60 § 5.1 Discover
  Features</a>