📄 semamgathrottledsubmitsmresp.java
字号:
package com.logica.smpp.pdu.invalid;
import com.logica.smpp.Data;
import com.logica.smpp.pdu.SubmitSMResp;
import com.logica.smpp.pdu.ValueNotSetException;
import com.logica.smpp.util.ByteBuffer;
/**
* @author paolo@bulksms.com
*
* For testing purposes only
*
* This will produce a submit_sm_resp with a throttled status, which has another
* submit_sm_resp PDU appended to it. This is based on real PDUs received from Sema MGA
* servers. Normally, I think, the remote server flushes the socket after every response,
* (which is locky for the code), but not after some throttling PDUs (there is
* nothing wrong with this of course, so it's not really "invalid").
*
* Surprisingly, two packets appended like this even seems to fool Ethereal (0.9.8)
* which reports the second packet as "trailing data".
*
* Given the state of the original Logica code, receiving two such PDUs in one
* buffer read would break the Receiver completely, mainly because the SubmitSmResp
* class was broken. This now works properly.
*/
public class SemaMGAThrottledSubmitSMResp extends SubmitSMResp
{
private String messageId = Data.DFLT_MSGID;
public SemaMGAThrottledSubmitSMResp()
{
super();
}
public ByteBuffer getData()
throws ValueNotSetException
{
ByteBuffer buffer = super.getData();
String garbage = "00000043800000040000000000005e4630332f2f33303730663733303030303030303030303330663962633033313635303030312f3132323734343434343434343000";
for (int i = 0; i < garbage.length(); i+=2) {
String thisCharString = garbage.substring(i,i+2);
char thisChar = (char)Integer.parseInt(thisCharString,16);
buffer.appendByte((byte)thisChar);
}
return buffer;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -