WebsocketClientTransport implements ClientTransport { @Override public Mono<DuplexConnection> connect() { return client .headers(headers -> headers.add(this.headers)) .websocket(specBuilder.build()) .uri(path) .connect() .map(WebsocketDuplexConnection::new); } private  WebsocketClientTransport(HttpClient client, String path); static WebsocketClientTransport create(int port); static WebsocketClientTransport create(String bindAddress, int port); static WebsocketClientTransport create(InetSocketAddress address); static WebsocketClientTransport create(TcpClient client); static WebsocketClientTransport create(URI uri); static WebsocketClientTransport create(HttpClient client, String path); WebsocketClientTransport header(String name, String... values); WebsocketClientTransport webSocketSpec(Consumer<WebsocketClientSpec.Builder> configurer); @Override int maxFrameLength(); @Override Mono<DuplexConnection> connect();  }
@DisplayName("connects to server") @Test void connect() { InetSocketAddress address = InetSocketAddress.createUnresolved("localhost", 0); WebsocketServerTransport serverTransport = WebsocketServerTransport.create(address); serverTransport .start(duplexConnection -> Mono.empty()) .flatMap(context -> WebsocketClientTransport.create(context.address()).connect()) .as(StepVerifier::create) .expectNextCount(1) .verifyComplete(); }