Example usage for org.springframework.http.server.reactive.bootstrap TomcatHttpServer TomcatHttpServer

List of usage examples for org.springframework.http.server.reactive.bootstrap TomcatHttpServer TomcatHttpServer

Introduction

In this page you can find the example usage for org.springframework.http.server.reactive.bootstrap TomcatHttpServer TomcatHttpServer.

Prototype

TomcatHttpServer

Source Link

Usage

From source file:playground.app.Application.java

public static void main(String[] args) throws Exception {

    HttpHandler httpHandler = createHttpHandler();

    HttpServer server = new TomcatHttpServer();
    server.setPort(8080);/*  w  w w  .ja v  a 2 s  . c o m*/
    server.setHandler(httpHandler);
    server.afterPropertiesSet();
    server.start();

    CompletableFuture<Void> stop = new CompletableFuture<>();
    Runtime.getRuntime().addShutdownHook(new Thread(() -> {
        stop.complete(null);
    }));
    synchronized (stop) {
        stop.wait();
    }
}

From source file:playground.itests.AbstractHttpHandlerIntegrationTests.java

@Before
public void setup() throws Exception {
    this.port = SocketUtils.findAvailableTcpPort();
    this.server = new TomcatHttpServer();
    this.server.setPort(this.port);
    this.server.setHandler(createHttpHandler());
    this.server.afterPropertiesSet();
    this.server.start();

    this.webClient = new WebClient(new ReactorClientHttpConnector());
}