Search in sources :

Example 1 with NioServer

use of oap.http.nio.NioServer in project oap by oaplatform.

the class WebServicesPerformance method nioThreads.

@Test
public void nioThreads() throws Exception {
    NioServer server = new NioServer(Env.port(), 500);
    try {
        WebServices ws = new WebServices(server, SESSION_MANAGER, GenericCorsPolicy.DEFAULT);
        ws.bind("x/v/math", GenericCorsPolicy.DEFAULT, new MathWS(), false, SESSION_MANAGER, Collections.emptyList(), Protocol.HTTP);
        server.start();
        // ??? TODO: fix me
        Thread.sleep(3000);
        HttpAsserts.reset();
        benchmark("NioServer.invocations", samples, () -> {
            try {
                HttpAsserts.assertGet(HTTP_URL("/x/v/math/id?a=aaa")).responded(200, "OK", ContentType.APPLICATION_JSON, "\"aaa\"");
            } catch (Throwable e) {
                e.printStackTrace();
            }
        }).inThreads(5000).run();
        HttpAsserts.reset();
    } finally {
        server.stop();
    }
}
Also used : NioServer(oap.http.nio.NioServer) Test(org.testng.annotations.Test)

Aggregations

NioServer (oap.http.nio.NioServer)1 Test (org.testng.annotations.Test)1