|
10 | 10 | import org.springframework.web.reactive.function.server.ServerResponse; |
11 | 11 | import reactor.core.publisher.Flux; |
12 | 12 | import reactor.core.publisher.Mono; |
13 | | -import reactor.netty.DisposableServer; |
14 | | -import reactor.netty.http.server.HttpServer; |
| 13 | +import reactor.ipc.netty.NettyContext; |
| 14 | +import reactor.ipc.netty.http.server.HttpServer; |
15 | 15 |
|
16 | 16 | import java.time.Duration; |
17 | 17 |
|
18 | 18 | import static org.springframework.web.reactive.function.server.RequestPredicates.GET; |
19 | 19 | import static org.springframework.web.reactive.function.server.RequestPredicates.POST; |
20 | 20 |
|
21 | 21 | public class Spring5ReactiveServerClientIntegrationTest { |
22 | | - private static DisposableServer nettyServer; |
| 22 | + private static NettyContext nettyContext; |
23 | 23 |
|
24 | 24 | @BeforeAll |
25 | 25 | public static void setUp() throws Exception { |
26 | | - HttpServer server = HttpServer.create().host("localhost").port(8080); |
| 26 | + HttpServer server = HttpServer.create("localhost", 8080); |
27 | 27 | RouterFunction<?> route = RouterFunctions.route(POST("/task/process"), request -> ServerResponse.ok() |
28 | 28 | .body(request.bodyToFlux(Task.class) |
29 | 29 | .map(ll -> new Task("TaskName", 1)), Task.class)) |
30 | 30 | .and(RouterFunctions.route(GET("/task"), request -> ServerResponse.ok() |
31 | 31 | .body(Mono.just("server is alive"), String.class))); |
32 | 32 | HttpHandler httpHandler = RouterFunctions.toHttpHandler(route); |
33 | 33 | ReactorHttpHandlerAdapter adapter = new ReactorHttpHandlerAdapter(httpHandler); |
34 | | - nettyServer = server.handle(adapter).bind().block(); |
| 34 | + nettyContext = server.newHandler(adapter) |
| 35 | + .block(); |
35 | 36 | } |
36 | 37 |
|
37 | 38 | @AfterAll |
38 | 39 | public static void shutDown() { |
39 | | - nettyServer.dispose(); |
| 40 | + nettyContext.dispose(); |
40 | 41 | } |
41 | 42 |
|
42 | 43 | // @Test |
|
0 commit comments