WebsocketRouteTransport extends BaseWebsocketServerTransport<WebsocketRouteTransport, Closeable> { @Override public Mono<Closeable> start(ConnectionAcceptor acceptor) { Objects.requireNonNull(acceptor, "acceptor must not be null"); return server .route( routes -> { routesBuilder.accept(routes); routes.ws(path, newHandler(acceptor), specBuilder.build()); }) .bind() .map(CloseableChannel::new); } WebsocketRouteTransport(
      HttpServer server, Consumer<? super HttpServerRoutes> routesBuilder, String path); @Override Mono<Closeable> start(ConnectionAcceptor acceptor); static BiFunction<WebsocketInbound, WebsocketOutbound, Publisher<Void>> newHandler(
      ConnectionAcceptor acceptor);  }
@DisplayName("starts server") @Test void start() { WebsocketRouteTransport serverTransport = new WebsocketRouteTransport(HttpServer.create(), routes -> {}, "/test-path"); serverTransport .start(duplexConnection -> Mono.empty()) .as(StepVerifier::create) .expectNextCount(1) .verifyComplete(); }
@DisplayName("start throw NullPointerException with null acceptor") @Test void startNullAcceptor() { assertThatNullPointerException() .isThrownBy( () -> new WebsocketRouteTransport(HttpServer.create(), routes -> {}, "/test-path") .start(null)) .withMessage("acceptor must not be null"); }