use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerFactoriesTest method hasDestinationHostSNA.
@Test
public void hasDestinationHostSNA() throws Exception {
SubscribeNotificationsAnswer sna = shServerFactory.createSubscribeNotificationsAnswer(shClientFactory.createSubscribeNotificationsRequest());
assertNull("The Destination-Host and Destination-Realm AVPs MUST NOT be present in the answer message. [RFC3588/6.2]", sna.getDestinationHost());
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerActivityImpl method createSubscribeNotificationsAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerActivity#createSubscribeNotificationsAnswer(long, boolean)
*/
public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer(long resultCode, boolean isExperimentalResult) {
// Fetch the session stored request
SubscribeNotificationsRequest req = (SubscribeNotificationsRequest) getSessionMessage(SubscribeNotificationsRequest.commandCode);
SubscribeNotificationsAnswer answer = null;
if (req != null) {
// Create answer from it
answer = this.messageFactory.createSubscribeNotificationsAnswer(req, resultCode, isExperimentalResult);
// Add any extra session data
addSessionData(answer);
// Store request data FIXME: Commented by Alex. Is this needed?
// ((DiameterShMessageImpl)answer).setData(req);
}
return answer;
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerSubscriptionActivityImpl method createSubscribeNotificationsAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#createSubscribeNotificationsAnswer(long, boolean)
*/
public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer(long resultCode, boolean isExperimentalResult) {
SubscribeNotificationsAnswer answer = null;
for (int index = 0; index < stateMessages.size(); index++) {
if (stateMessages.get(index).getCommand().getCode() == SubscribeNotificationsRequest.commandCode) {
SubscribeNotificationsRequest msg = (SubscribeNotificationsRequest) stateMessages.get(index);
answer = this.messageFactory.createSubscribeNotificationsAnswer(msg, resultCode, isExperimentalResult);
if (answer.getAuthSessionState() == null && this.authSessionState != null) {
answer.setAuthSessionState(this.authSessionState);
}
((DiameterShMessageImpl) answer).setData(msg);
break;
}
}
// answer.setSessionId(super.session.getSessionId());
return answer;
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerSubscriptionActivityImpl method sendSubscribeNotificationsAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#sendSubscribeNotificationsAnswer(net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer)
*/
public void sendSubscribeNotificationsAnswer(SubscribeNotificationsAnswer message) throws IOException {
try {
DiameterShMessageImpl msg = (DiameterShMessageImpl) message;
fetchSessionData(msg, false);
this.serverSession.sendSubscribeNotificationsAnswer(new SubscribeNotificationsAnswerImpl((Answer) msg.getGenericData()));
clean(msg);
} catch (org.jdiameter.api.validation.AvpNotAllowedException e) {
throw new AvpNotAllowedException("Message validation failed.", e, e.getAvpCode(), e.getVendorId());
} catch (Exception e) {
if (logger.isDebugEnabled()) {
logger.debug("Failed to send message.", e);
}
throw new IOException("Failed to send message, due to: " + e);
}
}
use of net.java.slee.resource.diameter.sh.events.SubscribeNotificationsAnswer in project jain-slee.diameter by RestComm.
the class ShServerSubscriptionActivityImpl method createSubscribeNotificationsAnswer.
/*
* (non-Javadoc)
* @see net.java.slee.resource.diameter.sh.server.ShServerSubscriptionActivity#createSubscribeNotificationsAnswer()
*/
public SubscribeNotificationsAnswer createSubscribeNotificationsAnswer() {
SubscribeNotificationsAnswer answer = null;
for (int index = 0; index < stateMessages.size(); index++) {
if (stateMessages.get(index).getCommand().getCode() == SubscribeNotificationsRequest.commandCode) {
SubscribeNotificationsRequest msg = (SubscribeNotificationsRequest) stateMessages.get(index);
answer = this.messageFactory.createSubscribeNotificationsAnswer(msg);
if (answer.getAuthSessionState() == null && this.authSessionState != null) {
answer.setAuthSessionState(this.authSessionState);
}
((DiameterShMessageImpl) answer).setData(msg);
break;
}
}
// answer.setSessionId(super.session.getSessionId());
return answer;
}
Aggregations