Add WebSocketClient for Java WebSocket (JSR-356)

Issue: SPR-14527
This commit is contained in:
Violeta Georgieva
2016-12-23 00:28:51 +02:00
committed by Rossen Stoyanchev
parent bd09a76a1e
commit 30ee71ea1a
5 changed files with 341 additions and 106 deletions

View File

@@ -41,6 +41,7 @@ import org.springframework.web.reactive.socket.WebSocketSession;
import org.springframework.web.reactive.socket.client.JettyWebSocketClient;
import org.springframework.web.reactive.socket.client.ReactorNettyWebSocketClient;
import org.springframework.web.reactive.socket.client.RxNettyWebSocketClient;
import org.springframework.web.reactive.socket.client.StandardWebSocketClient;
import org.springframework.web.reactive.socket.client.WebSocketClient;
import static org.junit.Assert.assertEquals;
@@ -78,6 +79,11 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
client.stop();
}
@Test
public void echoStandardClient() throws Exception {
testEcho(new StandardWebSocketClient());
}
private void testEcho(WebSocketClient client) throws URISyntaxException {
int count = 100;
Flux<String> input = Flux.range(1, count).map(index -> "msg-" + index);
@@ -113,6 +119,11 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
client.stop();
}
@Test
public void subProtocolStandardClient() throws Exception {
testSubProtocol(new StandardWebSocketClient());
}
private void testSubProtocol(WebSocketClient client) throws URISyntaxException {
String protocol = "echo-v1";
AtomicReference<HandshakeInfo> infoRef = new AtomicReference<>();