WebsocketServerTransport extends BaseWebsocketServerTransport<WebsocketServerTransport, CloseableChannel> { @Override public Mono<CloseableChannel> start(ConnectionAcceptor acceptor) { Objects.requireNonNull(acceptor, "acceptor must not be null"); return server .handle( (request, response) -> { response.headers(headers); return response.sendWebsocket( (in, out) -> acceptor .apply(new WebsocketDuplexConnection((Connection) in)) .then(out.neverComplete()), specBuilder.build()); }) .bind() .map(CloseableChannel::new); } private  WebsocketServerTransport(HttpServer server); static WebsocketServerTransport create(int port); static WebsocketServerTransport create(String bindAddress, int port); static WebsocketServerTransport create(InetSocketAddress address); static WebsocketServerTransport create(final HttpServer server); WebsocketServerTransport header(String name, String... values); @Override Mono<CloseableChannel> start(ConnectionAcceptor acceptor);  }
@DisplayName("starts server") @Test void start() { InetSocketAddress address = InetSocketAddress.createUnresolved("localhost", 0); WebsocketServerTransport serverTransport = WebsocketServerTransport.create(address); serverTransport .start(duplexConnection -> Mono.empty()) .as(StepVerifier::create) .expectNextCount(1) .verifyComplete(); }