/** Terminates the subscription (subscription goes into 'terminated' state). */ public void terminate(String reason) { Message req = MessageFactory.createNotifyRequest(this, event, id, null, null); SubscriptionStateHeader sh = new SubscriptionStateHeader(TERMINATED); if (reason != null) sh.setReason(reason); // sh.setExpires(0); req.setSubscriptionStateHeader(sh); notify(req); }
/** Sends a NOTIFY. */ public void notify(String state, int expires, String content_type, String body) { Message req = MessageFactory.createNotifyRequest(this, event, id, content_type, body); if (state != null) { SubscriptionStateHeader sh = new SubscriptionStateHeader(state); if (expires >= 0) sh.setExpires(expires); req.setSubscriptionStateHeader(sh); } notify(req); }