Polish SockJsClient
This commit is contained in:
@@ -218,7 +218,7 @@ public abstract class AbstractSockJsIntegrationTests {
|
||||
this.errorFilter.sleepDelayMap.put("/xhr_streaming", 10000L);
|
||||
this.errorFilter.responseStatusMap.put("/xhr_streaming", 503);
|
||||
initSockJsClient(createXhrTransport());
|
||||
this.sockJsClient.setTaskScheduler(this.wac.getBean(ThreadPoolTaskScheduler.class));
|
||||
this.sockJsClient.setConnectTimeoutScheduler(this.wac.getBean(ThreadPoolTaskScheduler.class));
|
||||
WebSocketSession clientSession = sockJsClient.doHandshake(clientHandler, this.baseUrl + "/echo").get();
|
||||
assertEquals("Fallback didn't occur", XhrClientSockJsSession.class, clientSession.getClass());
|
||||
TextMessage message = new TextMessage("message1");
|
||||
|
||||
@@ -22,8 +22,11 @@ import org.springframework.util.concurrent.ListenableFutureCallback;
|
||||
import org.springframework.web.socket.TextMessage;
|
||||
import org.springframework.web.socket.WebSocketHandler;
|
||||
import org.springframework.web.socket.WebSocketSession;
|
||||
import org.springframework.web.socket.sockjs.transport.TransportType;
|
||||
|
||||
import java.net.URI;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.verify;
|
||||
@@ -46,6 +49,11 @@ class TestTransport implements Transport {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransportType> getTransportTypes() {
|
||||
return Arrays.asList(TransportType.WEBSOCKET);
|
||||
}
|
||||
|
||||
public TransportRequest getRequest() {
|
||||
return this.request;
|
||||
}
|
||||
@@ -84,6 +92,13 @@ class TestTransport implements Transport {
|
||||
super(name);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TransportType> getTransportTypes() {
|
||||
return (isXhrStreamingDisabled() ?
|
||||
Arrays.asList(TransportType.XHR) :
|
||||
Arrays.asList(TransportType.XHR_STREAMING, TransportType.XHR));
|
||||
}
|
||||
|
||||
public void setStreamingDisabled(boolean streamingDisabled) {
|
||||
this.streamingDisabled = streamingDisabled;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user