Pastebin

Paste #1450: reply

< previous paste - next paste>

Pasted by tdn

Download View as text

    public byte[] reply(CodePacket packet) throws CodeException {
        byte[] result = null;
        switch(packet.getType()){
        case Code.ALIVE_REQUEST:
            //String seqNo = getTransNumber(packet.getOriginal());
            /*if(seqNo == null){
                log.error("Unable to get seqNo in packet: "+new String(packet.getOriginal()));
                return null;
            }*/
            //String timestamp = getTimeStamp();
            //result = ("<response><timestamp>"+timestamp.toString()+"</timestamp><status>true</status><seqNo>"+seqNo+"</seqNo><ping/></response>").getBytes();
            result = "<ping/>".getBytes();
          break;
        case Code.MESSAGE:
         //apperently no reply
          break;
        case Code.NOTIFICATION:
            result = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><cpaCall><response/></cpaCall>\n".getBytes();
            break;
        case Code.ALIVE_REPLY:
            result = "<ping/>".getBytes();
            break;
        case Code.LOGIN_REPLY:
        case Code.MESSAGE_RECEIVED:
          break;
        default:
          throw new CodeException("Unknown type: "+packet.getType());
        }
        if(log.isDebugEnabled()){
          log.debug("Reply is: "+result);
        }
        return result;
    }

New Paste


Do not write anything in this field if you're a human.

Go to most recent paste.