Add WebSocketClient for Jetty

Issue: SPR-14527
This commit is contained in:
Violeta Georgieva
2016-12-20 17:07:06 +02:00
committed by Rossen Stoyanchev
parent 113d1b6970
commit bd09a76a1e
4 changed files with 228 additions and 3 deletions

View File

@@ -38,6 +38,7 @@ import org.springframework.web.reactive.socket.HandshakeInfo;
import org.springframework.web.reactive.socket.WebSocketHandler;
import org.springframework.web.reactive.socket.WebSocketMessage;
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.WebSocketClient;
@@ -69,6 +70,14 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
testEcho(new RxNettyWebSocketClient());
}
@Test
public void echoJettyClient() throws Exception {
JettyWebSocketClient client = new JettyWebSocketClient();
client.start();
testEcho(client);
client.stop();
}
private void testEcho(WebSocketClient client) throws URISyntaxException {
int count = 100;
Flux<String> input = Flux.range(1, count).map(index -> "msg-" + index);
@@ -96,6 +105,14 @@ public class WebSocketIntegrationTests extends AbstractWebSocketIntegrationTests
testSubProtocol(new RxNettyWebSocketClient());
}
@Test
public void subProtocolJettyClient() throws Exception {
JettyWebSocketClient client = new JettyWebSocketClient();
client.start();
testSubProtocol(client);
client.stop();
}
private void testSubProtocol(WebSocketClient client) throws URISyntaxException {
String protocol = "echo-v1";
AtomicReference<HandshakeInfo> infoRef = new AtomicReference<>();