Pastebin
Paste #1451: reply
< previous paste - next paste>
Pasted by tdn
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:
log.debug("HACK: sending <ping/>");
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
Go to most recent paste.