code: protected void listen() {
          if (!connectedFlag.get() || releaseNeeded.get()) {
              return;
          }
  
          releaseNeeded.set(true);
          try {
              send(pushListener, new OnFinishedHandler() {
                  @Override
                  public void onFinished() {
                      releaseNeeded.set(false);
                      listen();
                  }
              });
          } catch (Exception e) {
              LOG.error("Error in sending long poll", e);
          }
      }
docs: listens for the pushListener to return. The pushListener must be set and pushEnabled must be true.