示例#1
0
 public void run() {
   int id = getChannelId();
   ApduType recvApdu;
   while (shouldRepeat()) {
     try {
       recvApdu = decoder.decode(input, ApduType.class);
       recvApdu.setChannel(id);
       inputQueue.add(recvApdu);
     } catch (InterruptedException e) {
       System.out.println("Interrupted receiver (" + id + ")");
     } catch (NullPointerException e) {
       // An APDUType is not received Ignore
       System.err.println("APDUType is not received");
     } catch (Exception e) {
       // EOF readed because channel is closed
       if (primary) eventHandler.processEvent(new Event(EventType.IND_TRANS_DESC));
     }
   }
   System.out.println("Receiver thread exiting (" + id + ").");
   releaseChannel();
 }
示例#2
0
 @Override
 public synchronized void process(ApduType apdu) {
   if (apdu.isPrstSelected()) {
     process.processPrstApdu(apdu.getPrst());
   } else if (apdu.isRlrqSelected()) {
     state_handler.send(MessageFactory.RlreApdu_NORMAL());
     state_handler.changeState(new MUnassociated(state_handler));
   } else if (apdu.isAarqSelected() || apdu.isAareSelected() || apdu.isRlreSelected()) {
     state_handler.send(MessageFactory.AbrtApdu_UNDEFINED());
     state_handler.changeState(new MUnassociated(state_handler));
   } else if (apdu.isAbrtSelected()) {
     state_handler.changeState(new MUnassociated(state_handler));
   }
 }