Fix failing test

Explicitly pass the client-side JSR-356 WebSocketContainer to the
TomcatWebSocketClient to prevent the ContainerProvider from finding
the one from undertow-websockets-jsr through the ServiceLoader API.
This commit is contained in:
Rossen Stoyanchev
2017-07-06 14:32:46 +02:00
parent b0ab84657b
commit acd6b9df06
2 changed files with 12 additions and 1 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.web.reactive.socket.client;
import javax.websocket.Session;
import javax.websocket.WebSocketContainer;
import org.springframework.web.reactive.socket.HandshakeInfo;
import org.springframework.web.reactive.socket.adapter.StandardWebSocketSession;
@@ -33,6 +34,14 @@ import reactor.core.publisher.MonoProcessor;
public class TomcatWebSocketClient extends StandardWebSocketClient {
public TomcatWebSocketClient() {
}
public TomcatWebSocketClient(WebSocketContainer webSocketContainer) {
super(webSocketContainer);
}
@Override
protected StandardWebSocketSession createWebSocketSession(Session session,
HandshakeInfo info, MonoProcessor<Void> completion) {

View File

@@ -21,6 +21,8 @@ import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import org.apache.tomcat.websocket.WsContainerProvider;
import org.apache.tomcat.websocket.WsWebSocketContainer;
import org.apache.tomcat.websocket.server.WsContextListener;
import org.junit.After;
import org.junit.Before;
@@ -93,7 +95,7 @@ public abstract class AbstractWebSocketIntegrationTests {
public static Object[][] arguments() throws IOException {
Flux<? extends WebSocketClient> clients = Flux.concat(
Flux.just(new TomcatWebSocketClient()).repeat(5),
Flux.just(new TomcatWebSocketClient(new WsWebSocketContainer())).repeat(5),
Flux.just(new JettyWebSocketClient()).repeat(5),
Flux.just(new ReactorNettyWebSocketClient()).repeat(5),
Flux.just(new RxNettyWebSocketClient()).repeat(5),