Search in sources :

Example 1 with HandshakeHandler

use of com.tvd12.ezyfoxserver.stresstest.handler.HandshakeHandler in project ezyfox-server-example by tvd12.

the class SocketClientSetup method setup.

public void setup(EzyClient client, boolean useUdp) {
    int count = counter.incrementAndGet();
    EzySetup setup = client.setup();
    setup.addDataHandler(EzyCommand.HANDSHAKE, new HandshakeHandler(count));
    setup.addDataHandler(EzyCommand.LOGIN, new LoginSuccessHandler(useUdp));
    setup.addDataHandler(EzyCommand.UDP_HANDSHAKE, new UdpHandshakeHandler());
    setup.addDataHandler(EzyCommand.APP_ACCESS, new AccessAppHandler(useUdp, messageCount, executorService));
    EzyAppSetup appSetup = setup.setupApp("hello-world");
    appSetup.addDataHandler("broadcastMessage", (app, data) -> {
    // String message = ((EzyObject)data).get("message", String.class);
    // System.out.println("tcp > server response: " + message);
    });
    appSetup.addDataHandler("udpBroadcastMessage", (app, data) -> {
    // String message = ((EzyObject)data).get("message", String.class);
    // System.out.println("udp > server response: " + message);
    });
}
Also used : UdpHandshakeHandler(com.tvd12.ezyfoxserver.stresstest.handler.UdpHandshakeHandler) HandshakeHandler(com.tvd12.ezyfoxserver.stresstest.handler.HandshakeHandler) EzyAppSetup(com.tvd12.ezyfoxserver.client.setup.EzyAppSetup) UdpHandshakeHandler(com.tvd12.ezyfoxserver.stresstest.handler.UdpHandshakeHandler) LoginSuccessHandler(com.tvd12.ezyfoxserver.stresstest.handler.LoginSuccessHandler) EzySetup(com.tvd12.ezyfoxserver.client.setup.EzySetup) AccessAppHandler(com.tvd12.ezyfoxserver.stresstest.handler.AccessAppHandler)

Aggregations

EzyAppSetup (com.tvd12.ezyfoxserver.client.setup.EzyAppSetup)1 EzySetup (com.tvd12.ezyfoxserver.client.setup.EzySetup)1 AccessAppHandler (com.tvd12.ezyfoxserver.stresstest.handler.AccessAppHandler)1 HandshakeHandler (com.tvd12.ezyfoxserver.stresstest.handler.HandshakeHandler)1 LoginSuccessHandler (com.tvd12.ezyfoxserver.stresstest.handler.LoginSuccessHandler)1 UdpHandshakeHandler (com.tvd12.ezyfoxserver.stresstest.handler.UdpHandshakeHandler)1