use of org.apache.hc.core5.http.impl.bootstrap.ServerBootstrap in project httpcomponents-core by apache.
the class TestingFramework method startServer.
private void startServer() throws TestingFrameworkException {
/*
* Start an in-process server and handle all HTTP requests
* with the requestHandler.
*/
final SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(15000, TimeUnit.MILLISECONDS).build();
final ServerBootstrap serverBootstrap = ServerBootstrap.bootstrap().setLookupRegistry(new UriPatternMatcher<>()).setSocketConfig(socketConfig).register("/*", requestHandler);
server = serverBootstrap.create();
try {
server.start();
} catch (final IOException e) {
throw new TestingFrameworkException(e);
}
port = server.getLocalPort();
}
Aggregations