PduRequest requestPdu = (PduRequest)pdu;
this.countReceiveRequestPdu(requestPdu);
long startTime = System.currentTimeMillis();
PduResponse responsePdu = this.sessionHandler.firePduRequestReceived(requestPdu);
// if the handler returned a non-null object, then we need to send it back on the channel
if (responsePdu != null) {
try {
long responseTime = System.currentTimeMillis() - startTime;
this.countSendResponsePdu(responsePdu, responseTime, responseTime);
this.sendResponsePdu(responsePdu);
} catch (Exception e) {
logger.error("Unable to cleanly return response PDU: {}", e);
}
}
} else {
// this is a response -- we need to check if its "expected" or "unexpected"
PduResponse responsePdu = (PduResponse)pdu;
int receivedPduSeqNum = pdu.getSequenceNumber();
try {
// see if a correlating request exists in the window
WindowFuture<Integer,PduRequest,PduResponse> future = this.sendWindow.complete(receivedPduSeqNum, responsePdu);