Search in sources :

Example 1 with SMPPMessageReceiveHandler

use of com.zx.sms.connect.manager.smpp.SMPPMessageReceiveHandler 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();
}
Also used : SMPPMessageReceiveHandler(com.zx.sms.connect.manager.smpp.SMPPMessageReceiveHandler) SMPPServerEndpointEntity(com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity) BusinessHandlerInterface(com.zx.sms.handler.api.BusinessHandlerInterface) ArrayList(java.util.ArrayList) EndpointManager(com.zx.sms.connect.manager.EndpointManager) SMPPServerChildEndpointEntity(com.zx.sms.connect.manager.smpp.SMPPServerChildEndpointEntity) Test(org.junit.Test)

Aggregations

EndpointManager (com.zx.sms.connect.manager.EndpointManager)1 SMPPMessageReceiveHandler (com.zx.sms.connect.manager.smpp.SMPPMessageReceiveHandler)1 SMPPServerChildEndpointEntity (com.zx.sms.connect.manager.smpp.SMPPServerChildEndpointEntity)1 SMPPServerEndpointEntity (com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity)1 BusinessHandlerInterface (com.zx.sms.handler.api.BusinessHandlerInterface)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1