Search in sources :

Example 1 with SMPPServerEndpointEntity

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();
}
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)

Example 2 with SMPPServerEndpointEntity

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;
}
Also used : BindTransceiver(com.zx.sms.codec.smpp.msg.BindTransceiver) SMPPServerEndpointEntity(com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity) BindReceiver(com.zx.sms.codec.smpp.msg.BindReceiver) BindTransmitter(com.zx.sms.codec.smpp.msg.BindTransmitter) BaseBind(com.zx.sms.codec.smpp.msg.BaseBind) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity) SMPPEndpointEntity(com.zx.sms.connect.manager.smpp.SMPPEndpointEntity) SMPPServerEndpointEntity(com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity)

Aggregations

SMPPServerEndpointEntity (com.zx.sms.connect.manager.smpp.SMPPServerEndpointEntity)2 BaseBind (com.zx.sms.codec.smpp.msg.BaseBind)1 BindReceiver (com.zx.sms.codec.smpp.msg.BindReceiver)1 BindTransceiver (com.zx.sms.codec.smpp.msg.BindTransceiver)1 BindTransmitter (com.zx.sms.codec.smpp.msg.BindTransmitter)1 EndpointEntity (com.zx.sms.connect.manager.EndpointEntity)1 EndpointManager (com.zx.sms.connect.manager.EndpointManager)1 SMPPEndpointEntity (com.zx.sms.connect.manager.smpp.SMPPEndpointEntity)1 SMPPMessageReceiveHandler (com.zx.sms.connect.manager.smpp.SMPPMessageReceiveHandler)1 SMPPServerChildEndpointEntity (com.zx.sms.connect.manager.smpp.SMPPServerChildEndpointEntity)1 BusinessHandlerInterface (com.zx.sms.handler.api.BusinessHandlerInterface)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1