Search in sources :

Example 1 with SgipReportRequestMessageHandler

use of com.zx.sms.handler.sgip.SgipReportRequestMessageHandler in project SMSGate by Lihuanghe.

the class TestSgipEndPoint method testsgipEndpoint.

@Test
public void testsgipEndpoint() throws Exception {
    ResourceLeakDetector.setLevel(Level.ADVANCED);
    final EndpointManager manager = EndpointManager.INS;
    SgipServerEndpointEntity server = new SgipServerEndpointEntity();
    server.setId("sgipserver");
    server.setHost("127.0.0.1");
    server.setPort(8001);
    server.setValid(true);
    // 使用ssl加密数据流
    server.setUseSSL(false);
    SgipServerChildEndpointEntity child = new SgipServerChildEndpointEntity();
    child.setId("sgipchild");
    child.setLoginName("333");
    child.setLoginPassowrd("0555");
    child.setNodeId(3025000001L);
    child.setValid(true);
    child.setChannelType(ChannelType.DUPLEX);
    child.setMaxChannels((short) 3);
    child.setRetryWaitTimeSec((short) 30);
    child.setMaxRetryCnt((short) 3);
    child.setReSendFailMsg(false);
    child.setIdleTimeSec((short) 30);
    // child.setWriteLimit(200);
    // child.setReadLimit(200);
    child.setSupportLongmsg(SupportLongMessage.BOTH);
    List<BusinessHandlerInterface> serverhandlers = new ArrayList<BusinessHandlerInterface>();
    serverhandlers.add(new SGIPMessageReceiveHandler());
    child.setBusinessHandlerSet(serverhandlers);
    server.addchild(child);
    manager.addEndpointEntity(server);
    SgipClientEndpointEntity client = new SgipClientEndpointEntity();
    client.setId("sgipclient");
    client.setHost("127.0.0.1");
    client.setPort(8001);
    client.setLoginName("333");
    client.setLoginPassowrd("0555");
    client.setChannelType(ChannelType.DUPLEX);
    client.setNodeId(3073100002L);
    client.setMaxChannels((short) 10);
    client.setRetryWaitTimeSec((short) 100);
    client.setUseSSL(false);
    client.setReSendFailMsg(false);
    client.setIdleTimeSec((short) 120);
    // client.setWriteLimit(200);
    // client.setReadLimit(200);
    List<BusinessHandlerInterface> clienthandlers = new ArrayList<BusinessHandlerInterface>();
    clienthandlers.add(new SgipReportRequestMessageHandler());
    clienthandlers.add(new SGIPSessionConnectedHandler(10000));
    client.setBusinessHandlerSet(clienthandlers);
    manager.addEndpointEntity(client);
    manager.openAll();
    Thread.sleep(1000);
    System.out.println("start.....");
    LockSupport.park();
    EndpointManager.INS.close();
}
Also used : SgipReportRequestMessageHandler(com.zx.sms.handler.sgip.SgipReportRequestMessageHandler) BusinessHandlerInterface(com.zx.sms.handler.api.BusinessHandlerInterface) ArrayList(java.util.ArrayList) EndpointManager(com.zx.sms.connect.manager.EndpointManager) Test(org.junit.Test)

Aggregations

EndpointManager (com.zx.sms.connect.manager.EndpointManager)1 BusinessHandlerInterface (com.zx.sms.handler.api.BusinessHandlerInterface)1 SgipReportRequestMessageHandler (com.zx.sms.handler.sgip.SgipReportRequestMessageHandler)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1