Java Code Examples for org.apache.http.impl.bootstrap.ServerBootstrap#create()
The following examples show how to use
org.apache.http.impl.bootstrap.ServerBootstrap#create() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TestHttpServer.java From brooklyn-server with Apache License 2.0 | 6 votes |
public TestHttpServer start() { checkNotStarted(); HttpProcessor httpProcessor = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors); int port = Networking.nextAvailablePort(basePort); ServerBootstrap bootstrap = ServerBootstrap.bootstrap() .setListenerPort(port) .setLocalAddress(getLocalAddress()) .setHttpProcessor(httpProcessor); for (HandlerTuple tuple : handlers) { bootstrap.registerHandler(tuple.path, tuple.handler); } server = bootstrap.create(); try { server.start(); } catch (IOException e) { throw Exceptions.propagate(e); } return this; }
Example 2
Source File: TestWebServer.java From curly with Apache License 2.0 | 5 votes |
private TestWebServer(int port) throws IOException, InterruptedException { this.port=port; ServerBootstrap bootstrap = ServerBootstrap.bootstrap(); bootstrap.setListenerPort(port); bootstrap.setServerInfo("Test/1.1"); bootstrap.setSocketConfig(SocketConfig.DEFAULT); bootstrap.registerHandler("*", this::handleHttpRequest); server = bootstrap.create(); server.start(); }