Search in sources :

Example 1 with EzySimpleHandshakeRequest

use of com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest in project ezyfox-server by youngmonkeys.

the class EzyHandShakeController2Test method test.

@Test
public void test() {
    EzyServerContext ctx = newServerContext();
    EzySession first = getSessionManager(ctx).provideSession(EzyConnectionType.SOCKET);
    System.err.println("first.token:    " + first);
    System.err.println("alive sessions: " + getSessionManager(ctx).getAliveSessions());
    assertTrue(getSessionManager(ctx).containsSession(first.getId()));
    EzySession session = getSessionManager(ctx).provideSession(EzyConnectionType.SOCKET);
    System.err.println("session: " + session);
    EzyArray data = newHandShakeData(first.getToken());
    EzySimpleHandshakeRequest request = new EzySimpleHandshakeRequest();
    request.deserializeParams(data);
    request.setSession(session);
    EzyHandshakeParams requestParams = request.getParams();
    assertEquals(first.getToken(), requestParams.getReconnectToken());
    EzyHandshakeController controller = new EzyHandshakeController();
    controller.handle(ctx, request);
}
Also used : EzyHandshakeParams(com.tvd12.ezyfoxserver.request.EzyHandshakeParams) EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyArray(com.tvd12.ezyfox.entity.EzyArray) EzySimpleHandshakeRequest(com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest) EzyHandshakeController(com.tvd12.ezyfoxserver.controller.EzyHandshakeController) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) Test(org.testng.annotations.Test)

Example 2 with EzySimpleHandshakeRequest

use of com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest in project ezyfox-server by youngmonkeys.

the class EzyHandShakeControllerTest method test.

@Test
public void test() {
    EzyServerContext ctx = newServerContext();
    EzySession session = newSession();
    EzyArray data = newHandShakeData();
    EzyHandshakeController controller = new EzyHandshakeController();
    EzySimpleHandshakeRequest request = new EzySimpleHandshakeRequest();
    request.deserializeParams(data);
    request.setSession(session);
    controller.handle(ctx, request);
}
Also used : EzyServerContext(com.tvd12.ezyfoxserver.context.EzyServerContext) EzyArray(com.tvd12.ezyfox.entity.EzyArray) EzySimpleHandshakeRequest(com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest) EzyHandshakeController(com.tvd12.ezyfoxserver.controller.EzyHandshakeController) EzySession(com.tvd12.ezyfoxserver.entity.EzySession) Test(org.testng.annotations.Test)

Example 3 with EzySimpleHandshakeRequest

use of com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest in project ezyfox-server by youngmonkeys.

the class EzyHandShakeControllerTest method testDeserializeParamsPerformance.

@Test
public void testDeserializeParamsPerformance() {
    EzyArray data = newHandShakeData();
    long time = Performance.create().test(() -> {
        EzySimpleHandshakeRequest request = new EzySimpleHandshakeRequest();
        request.deserializeParams(data);
    }).getTime();
    System.out.println("testDeserializeParamsPerformance, time = " + time);
}
Also used : EzyArray(com.tvd12.ezyfox.entity.EzyArray) EzySimpleHandshakeRequest(com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest) Test(org.testng.annotations.Test)

Aggregations

EzyArray (com.tvd12.ezyfox.entity.EzyArray)3 EzySimpleHandshakeRequest (com.tvd12.ezyfoxserver.request.EzySimpleHandshakeRequest)3 Test (org.testng.annotations.Test)3 EzyServerContext (com.tvd12.ezyfoxserver.context.EzyServerContext)2 EzyHandshakeController (com.tvd12.ezyfoxserver.controller.EzyHandshakeController)2 EzySession (com.tvd12.ezyfoxserver.entity.EzySession)2 EzyHandshakeParams (com.tvd12.ezyfoxserver.request.EzyHandshakeParams)1