code: public String RTMPPublishURL(String domain, String hub, String streamKey, int expireAfterSeconds) {
          long expire = System.currentTimeMillis() / 1000 + expireAfterSeconds;
          String path = String.format("/%s/%s?e=%d", hub, streamKey, expire);
          String token;
          try {
              token = this.cli.getMac().sign(path);
          } catch (Exception e) {
              e.printStackTrace();
              return null;
          }
          return String.format("rtmp://%s%s&token=%s", domain, path, token);
      }
docs: /*
  RTMPPublishURL generates RTMP publish URL
  expireAfterSeconds means URL will be invalid after expireAfterSeconds.