assertEquals(_sessionId, message.getSessionId());
assertEquals(_session, message.getSession());
}
else
{
DiameterServletAnswer sna;
DiameterServletRequest request = (DiameterServletRequest) message;
assertEquals(true, message.isRequest());
assertEquals(Sh.SNR, request.getCommand());
assertEquals(request.getApplicationId(), Sh.SH_APPLICATION_ID.getId());
assertEquals(request.getDestinationHost(), "server");
sna = request.createAnswer(Common.DIAMETER_SUCCESS);
_sessionId = request.getSessionId();
assertNotNull(_sessionId);
_session = request.getSession();
assertNotNull(_session);
sna.send();
Thread.sleep(50);
DiameterServletRequest pnr = _session.createRequest(Sh.PNR, true);
pnr.send();
}
}
};
_server.setHandler(serverHandler);
_server.start();
TestDiameterHandler clientHandler = new TestDiameterHandler()
{
private String _sessionId;
private DiameterSession _session;
@Override
public void doHandle(DiameterMessage message) throws Throwable
{
if (message instanceof DiameterServletAnswer)
{
DiameterServletAnswer sna = (DiameterServletAnswer) message;
assertEquals(Sh.SNA, sna.getCommand());
assertEquals(sna.getApplicationId(), Sh.SH_APPLICATION_ID.getId());
_sessionId = sna.getSessionId();
_session = sna.getSession();
assertNotNull(_sessionId);
assertNotNull(_session);
assertEquals(_sessionId, sna.getRequest().getSessionId());
}
else
{
DiameterServletRequest pnr = (DiameterServletRequest) message;
assertEquals(Sh.PNR, pnr.getCommand());