use of org.apache.http.protocol.HttpProcessorBuilder in project LogHub by fbacchella.
the class HttpTestServer method before.
@Override
protected void before() throws Throwable {
HttpProcessorBuilder builder = HttpProcessorBuilder.create().add(new ResponseDate()).add(new ResponseServer("MyServer-HTTP/1.1")).add(new ResponseContent()).add(new ResponseConnControl());
HttpProcessor httpProcessor = builder.build();
SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(15000).setTcpNoDelay(true).build();
ServerBootstrap bootstrap = ServerBootstrap.bootstrap().setListenerPort(port).setHttpProcessor(httpProcessor).setSocketConfig(socketConfig);
if (ssl != null) {
bootstrap.setSslContext(ssl);
}
Arrays.stream(handlers).forEach(i -> bootstrap.registerHandler(i.getKey(), i.getValue()));
server = bootstrap.create();
server.start();
}
Aggregations