// bind and get the simulator session
PollableSmppSessionHandler sessionHandler = new PollableSmppSessionHandler();
DefaultSmppSession session = (DefaultSmppSession)bootstrap.bind(configuration, sessionHandler);
SmppSimulatorSessionHandler simulator0 = server.pollNextSession(1000);
simulator0.setPduProcessor(null);
try {
EnquireLink el0 = new EnquireLink();
el0.setSequenceNumber(0x1001);
EnquireLinkResp el0Resp = el0.createResponse();
// send a request and wait for a response that never shows up
WindowFuture future = session.sendRequestPdu(el0, 50, true);
Assert.assertFalse(future.await());
// a call to cancel() is usually done in sendRequestPduAndGetResponse
// but for this test we'll manually need to call it here
future.cancel();
Assert.assertEquals(WindowFuture.CALLER_WAITING_TIMEOUT, future.getCallerStateHint());
// send a response now after the caller would have timed out
simulator0.sendPdu(el0Resp);
// we should have received an unexpected PDU response
Assert.assertEquals(0, sessionHandler.getReceivedPduRequests().size());
Assert.assertEquals(0, sessionHandler.getReceivedExpectedPduResponses().size());
PduResponse pdu0 = sessionHandler.getReceivedUnexpectedPduResponses().poll(1000, TimeUnit.MILLISECONDS);