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