Search in sources :

Example 1 with EzyWsClient

use of com.tvd12.ezyfoxserver.client.EzyWsClient in project ezyfox-server-example by tvd12.

the class WebSocketStresstest method main.

public static void main(String[] args) throws Exception {
    DefaultClientConfig clientConfig = new DefaultClientConfig();
    SocketClientSetup setup = new SocketClientSetup("websocket");
    EzyClients clients = EzyClients.getInstance();
    new Thread(() -> {
        int clientCount = 300;
        for (int i = 0; i < clientCount; i++) {
            EzyWsClient client = new EzyWsClient(clientConfig.get(i));
            try {
                Thread.sleep(50);
            } catch (Exception e) {
                e.printStackTrace();
            }
            setup.setup(client, false);
            clients.addClient(client);
            client.connect("ws://127.0.0.1:2208/ws");
        }
    }).start();
    EzyMainEventsLoop mainEventsLoop = new EzyMainEventsLoop();
    mainEventsLoop.start(5);
}
Also used : EzyWsClient(com.tvd12.ezyfoxserver.client.EzyWsClient) EzyClients(com.tvd12.ezyfoxserver.client.EzyClients) EzyMainEventsLoop(com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)

Aggregations

EzyClients (com.tvd12.ezyfoxserver.client.EzyClients)1 EzyWsClient (com.tvd12.ezyfoxserver.client.EzyWsClient)1 EzyMainEventsLoop (com.tvd12.ezyfoxserver.client.socket.EzyMainEventsLoop)1