Search in sources :

Example 1 with DebuggingSlicePool

use of io.undertow.testutils.DebuggingSlicePool in project undertow by undertow-io.

the class H2CUpgradeContinuationTestCase method beforeClass.

/**
 * Initializes the server with the H2C handler and adds the echo handler to
 * manage the requests.
 * @throws IOException Some error
 */
@BeforeClass
public static void beforeClass() throws IOException {
    // server and client pool is using 1024 for the buffer size
    smallPool = new DebuggingSlicePool(new DefaultByteBufferPool(true, 1024, 1000, 10, 100));
    final PathHandler path = new PathHandler().addExactPath(ECHO_PATH, new HttpHandler() {

        @Override
        public void handleRequest(HttpServerExchange exchange) throws Exception {
            sendEchoResponse(exchange);
        }
    });
    server = Undertow.builder().setByteBufferPool(smallPool).addHttpListener(DefaultServer.getHostPort("default") + 1, DefaultServer.getHostAddress("default"), new Http2UpgradeHandler(path)).setSocketOption(Options.REUSE_ADDRESSES, true).build();
    server.start();
    // Create xnio worker
    final Xnio xnio = Xnio.getInstance();
    final XnioWorker xnioWorker = xnio.createWorker(null, OptionMap.builder().set(Options.WORKER_IO_THREADS, 8).set(Options.TCP_NODELAY, true).set(Options.KEEP_ALIVE, true).getMap());
    worker = xnioWorker;
}
Also used : HttpServerExchange(io.undertow.server.HttpServerExchange) HttpHandler(io.undertow.server.HttpHandler) DefaultByteBufferPool(io.undertow.server.DefaultByteBufferPool) Http2UpgradeHandler(io.undertow.server.protocol.http2.Http2UpgradeHandler) Xnio(org.xnio.Xnio) XnioWorker(org.xnio.XnioWorker) DebuggingSlicePool(io.undertow.testutils.DebuggingSlicePool) PathHandler(io.undertow.server.handlers.PathHandler) IOException(java.io.IOException) BeforeClass(org.junit.BeforeClass)

Aggregations

DefaultByteBufferPool (io.undertow.server.DefaultByteBufferPool)1 HttpHandler (io.undertow.server.HttpHandler)1 HttpServerExchange (io.undertow.server.HttpServerExchange)1 PathHandler (io.undertow.server.handlers.PathHandler)1 Http2UpgradeHandler (io.undertow.server.protocol.http2.Http2UpgradeHandler)1 DebuggingSlicePool (io.undertow.testutils.DebuggingSlicePool)1 IOException (java.io.IOException)1 BeforeClass (org.junit.BeforeClass)1 Xnio (org.xnio.Xnio)1 XnioWorker (org.xnio.XnioWorker)1