Search in sources :

Example 1 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class SgipClientEndpointConnector method doinitPipeLine.

@Override
protected void doinitPipeLine(ChannelPipeline pipeline) {
    EndpointEntity entity = getEndpointEntity();
    pipeline.addLast(GlobalConstance.IdleCheckerHandlerName, new IdleStateHandler(0, 0, entity.getIdleTimeSec(), TimeUnit.SECONDS));
    pipeline.addLast("SgipServerIdleStateHandler", GlobalConstance.sgipidleHandler);
    pipeline.addLast(SgipCodecChannelInitializer.pipeName(), new SgipCodecChannelInitializer());
    pipeline.addLast("sessionLoginManager", new SgipSessionLoginManager(getEndpointEntity()));
}
Also used : SgipSessionLoginManager(com.zx.sms.session.sgip.SgipSessionLoginManager) IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 2 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class SMGPClientEndpointConnector method doinitPipeLine.

@Override
protected void doinitPipeLine(ChannelPipeline pipeline) {
    EndpointEntity entity = getEndpointEntity();
    pipeline.addLast(GlobalConstance.IdleCheckerHandlerName, new IdleStateHandler(0, 0, entity.getIdleTimeSec(), TimeUnit.SECONDS));
    pipeline.addLast("SmgpServerIdleStateHandler", GlobalConstance.smgpidleHandler);
    pipeline.addLast(SMGPCodecChannelInitializer.pipeName(), new SMGPCodecChannelInitializer((int) ((SMGPEndpointEntity) entity).getClientVersion()));
    pipeline.addLast("sessionLoginManager", new SMGPSessionLoginManager(getEndpointEntity()));
}
Also used : IdleStateHandler(io.netty.handler.timeout.IdleStateHandler) SMGPSessionLoginManager(com.zx.sms.session.smgp.SMGPSessionLoginManager) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 3 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class ChannelUtil method asyncWriteToEntity.

public static ChannelFuture asyncWriteToEntity(String entity, Object msg) {
    EndpointEntity e = EndpointManager.INS.getEndpointEntity(entity);
    EndpointConnector connector = e.getSingletonConnector();
    return asyncWriteToEntity(connector, msg, null);
}
Also used : EndpointConnector(com.zx.sms.connect.manager.EndpointConnector) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 4 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class SMGPSessionConnectedHandler method createTestReq.

@Override
protected BaseMessage createTestReq(String content) {
    final EndpointEntity finalentity = getEndpointEntity();
    if (finalentity instanceof ServerEndpoint) {
        SMGPDeliverMessage pdu = new SMGPDeliverMessage();
        pdu.setDestTermId("10086");
        pdu.setMsgContent(content);
        pdu.setSrcTermId("13800138000");
        return pdu;
    } else {
        SMGPSubmitMessage pdu = new SMGPSubmitMessage();
        pdu.setSrcTermId("10086");
        pdu.setDestTermIdArray("13800138000");
        pdu.setMsgContent(content);
        return pdu;
    }
}
Also used : SMGPDeliverMessage(com.zx.sms.codec.smgp.msg.SMGPDeliverMessage) SMGPSubmitMessage(com.zx.sms.codec.smgp.msg.SMGPSubmitMessage) ServerEndpoint(com.zx.sms.connect.manager.ServerEndpoint) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity)

Example 5 with EndpointEntity

use of com.zx.sms.connect.manager.EndpointEntity in project SMSGate by Lihuanghe.

the class TestTcpEndPoint method testEchoTcpEndpoint.

@Test
public void testEchoTcpEndpoint() throws Exception {
    int port = 7890;
    final EndpointManager manager = EndpointManager.INS;
    final EndpointEntity server = new TCPServerEndpointEntity(port);
    server.setId("svrID");
    EndpointEntity client = new TCPClientEndpointEntity("127.0.0.1", port);
    client.setId("tcpid");
    client.setMaxChannels((short) 2);
    manager.addEndpointEntity(server);
    manager.addEndpointEntity(client);
    // manager.addEndpointEntity(new TCPClientEndpointEntity("221.176.67.103",port));
    // manager.addEndpointEntity(client);
    // manager.addEndpointEntity(new TCPClientEndpointEntity("192.168.1.103",port));
    // manager.addEndpointEntity(new TCPClientEndpointEntity("192.168.1.103",port));
    // manager.addEndpointEntity(new TCPClientEndpointEntity("192.168.1.103",port));
    // manager.addEndpointEntity(new TCPClientEndpointEntity("192.168.1.103",port));
    // manager.addEndpointEntity(new TCPClientEndpointEntity("192.168.1.103",port));
    // manager.addEndpointEntity(new TCPClientEndpointEntity("192.168.1.103",port));
    manager.openAll();
    // EventLoopGroupFactory.INS.getWorker().scheduleAtFixedRate(new Runnable() {
    // @Override
    // public void run() {
    // logger.info("connections: {}",manager.getEndpointConnector(server).getConnectionNum());
    // }
    // }, 10, 10, TimeUnit.SECONDS);
    Thread.sleep(5000);
    client.getSingletonConnector().fetch().writeAndFlush(Unpooled.wrappedBuffer(new byte[] { 1 }));
    Thread.sleep(10000);
    Set<EndpointEntity> entities = CMPPEndpointManager.INS.allEndPointEntity();
    for (EndpointEntity en : entities) {
        CMPPEndpointManager.INS.close(en);
    }
}
Also used : CMPPEndpointManager(com.zx.sms.connect.manager.CMPPEndpointManager) EndpointManager(com.zx.sms.connect.manager.EndpointManager) EndpointEntity(com.zx.sms.connect.manager.EndpointEntity) Test(org.junit.Test)

Aggregations

EndpointEntity (com.zx.sms.connect.manager.EndpointEntity)18 IdleStateHandler (io.netty.handler.timeout.IdleStateHandler)8 EndpointConnector (com.zx.sms.connect.manager.EndpointConnector)4 ServerEndpoint (com.zx.sms.connect.manager.ServerEndpoint)3 EndpointManager (com.zx.sms.connect.manager.EndpointManager)2 SgipSessionLoginManager (com.zx.sms.session.sgip.SgipSessionLoginManager)2 SMGPSessionLoginManager (com.zx.sms.session.smgp.SMGPSessionLoginManager)2 SMPPSessionLoginManager (com.zx.sms.session.smpp.SMPPSessionLoginManager)2 CmppDeliverRequestMessage (com.zx.sms.codec.cmpp.msg.CmppDeliverRequestMessage)1 CmppSubmitRequestMessage (com.zx.sms.codec.cmpp.msg.CmppSubmitRequestMessage)1 SMGPDeliverMessage (com.zx.sms.codec.smgp.msg.SMGPDeliverMessage)1 SMGPLoginMessage (com.zx.sms.codec.smgp.msg.SMGPLoginMessage)1 SMGPSubmitMessage (com.zx.sms.codec.smgp.msg.SMGPSubmitMessage)1 Address (com.zx.sms.codec.smpp.Address)1 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 DeliverSm (com.zx.sms.codec.smpp.msg.DeliverSm)1 SubmitSm (com.zx.sms.codec.smpp.msg.SubmitSm)1