use of com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity in project SMSGate by Lihuanghe.
the class TestWithOpenSMPP method test.
@Test
public void test() throws Exception {
final EndpointManager manager = EndpointManager.INS;
SMPPServerEndpointEntity server = new SMPPServerEndpointEntity();
server.setId("sms-core-smppserver");
server.setHost("127.0.0.1");
server.setPort(port);
server.setValid(true);
// 使用ssl加密数据流
server.setUseSSL(false);
SMPPServerChildEndpointEntity child = new SMPPServerChildEndpointEntity();
child.setId("smppchild");
child.setSystemId(systemId);
child.setPassword(password);
child.setValid(true);
child.setChannelType(ChannelType.DOWN);
child.setMaxChannels((short) 3);
child.setRetryWaitTimeSec((short) 30);
child.setMaxRetryCnt((short) 3);
child.setReSendFailMsg(false);
child.setIdleTimeSec((short) 15);
// child.setWriteLimit(200);
// child.setReadLimit(200);
List<BusinessHandlerInterface> serverhandlers = new ArrayList<BusinessHandlerInterface>();
serverhandlers.add(new SMPPMessageReceiveHandler());
child.setBusinessHandlerSet(serverhandlers);
server.addchild(child);
manager.addEndpointEntity(server);
manager.openAll();
Thread.sleep(2000);
System.out.println("start.....");
bind();
String randomStr = String.valueOf(RandomUtils.nextInt(0, 10000));
sendsubmit("@£$¥èéùìòÇ\nØø\rÅåΔ_ΦΓΛΩΠΨΣΘΞÆæßÉ !\"#¤%&'()*+,-./0123456789:;<=>?¡ABCDEFGHIJKLMNOPQRSTUVWXYZÄÖÑܧ¿abcdefghijklmnopqrstuvwxyzäöñüà^{}\\[~]|" + randomStr, Data.ENC_GSM7BIT);
sendsubmit("尊敬的客户,您好!您于2016-03-23 14:51:36通过中国移动10085销售专线订购的【一加手机高清防刮保护膜】" + randomStr, Data.ENC_UTF16_BE);
unbind();
}
use of com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity in project SMSGate by Lihuanghe.
the class SMPPSessionLoginManager method queryEndpointEntityByMsg.
@Override
protected EndpointEntity queryEndpointEntityByMsg(Object msg) {
if (msg instanceof BaseBind) {
BaseBind message = (BaseBind) msg;
String username = message.getSystemId();
if (entity instanceof SMPPServerEndpointEntity) {
SMPPServerEndpointEntity serverEntity = (SMPPServerEndpointEntity) entity;
if (msg instanceof BindTransmitter) {
EndpointEntity end = serverEntity.getChild(username.trim(), ChannelType.DOWN);
return end;
} else if (msg instanceof BindReceiver) {
EndpointEntity end = serverEntity.getChild(username.trim(), ChannelType.UP);
return end;
} else if (msg instanceof BindTransceiver) {
EndpointEntity end = serverEntity.getChild(username.trim(), ChannelType.DUPLEX);
return end;
}
}
}
return null;
}
Aggregations