WebsocketClientTransport implements ClientTransport { public static WebsocketClientTransport create(int port) { return create(TcpClient.create().port(port)); } 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("creates client with BindAddress") @Test void createBindAddress() { assertThat(WebsocketClientTransport.create("test-bind-address", 8000)) .isNotNull() .hasFieldOrPropertyWithValue("path", "/"); }
@DisplayName("creates client with HttpClient") @Test void createHttpClient() { assertThat(WebsocketClientTransport.create(HttpClient.create(), "/")) .isNotNull() .hasFieldOrPropertyWithValue("path", "/"); }
@DisplayName("creates client with HttpClient and path without root") @Test void createHttpClientWithPathWithoutRoot() { assertThat(WebsocketClientTransport.create(HttpClient.create(), "test")) .isNotNull() .hasFieldOrPropertyWithValue("path", "/test"); }
@DisplayName("creates client with InetSocketAddress") @Test void createInetSocketAddress() { assertThat( WebsocketClientTransport.create( InetSocketAddress.createUnresolved("test-bind-address", 8000))) .isNotNull() .hasFieldOrPropertyWithValue("path", "/"); }
@DisplayName("create throws NullPointerException with null bindAddress") @Test void createNullBindAddress() { assertThatNullPointerException() .isThrownBy(() -> WebsocketClientTransport.create(null, 8000)) .withMessage("host"); }
@DisplayName("create throws NullPointerException with null client") @Test void createNullHttpClient() { assertThatNullPointerException() .isThrownBy(() -> WebsocketClientTransport.create(null, "/test-path")) .withMessage("HttpClient must not be null"); }
@DisplayName("create throws NullPointerException with null address") @Test void createNullInetSocketAddress() { assertThatNullPointerException() .isThrownBy(() -> WebsocketClientTransport.create((InetSocketAddress) null)) .withMessage("address must not be null"); }
@DisplayName("create throws NullPointerException with null path") @Test void createNullPath() { assertThatNullPointerException() .isThrownBy(() -> WebsocketClientTransport.create(HttpClient.create(), null)) .withMessage("path must not be null"); }
@DisplayName("create throws NullPointerException with null URI") @Test void createNullUri() { assertThatNullPointerException() .isThrownBy(() -> WebsocketClientTransport.create((URI) null)) .withMessage("uri must not be null"); }
@DisplayName("creates client with port") @Test void createPort() { assertThat(WebsocketClientTransport.create(8000)).isNotNull(); }
@DisplayName("creates client with URI") @Test void createUri() { assertThat(WebsocketClientTransport.create(URI.create("ws: .isNotNull() .hasFieldOrPropertyWithValue("path", "/"); }
@DisplayName("creates client with URI path") @Test void createUriPath() { assertThat(WebsocketClientTransport.create(URI.create("ws: .isNotNull() .hasFieldOrPropertyWithValue("path", "/test"); }