Search in sources :

Example 1 with WsWebSocketContainer

use of org.apache.tomcat.websocket.WsWebSocketContainer in project spring-boot by spring-projects.

the class WebSocketMessagingAutoConfigurationTests method setup.

@Before
public void setup() {
    List<Transport> transports = Arrays.asList(new WebSocketTransport(new StandardWebSocketClient(new WsWebSocketContainer())), new RestTemplateXhrTransport(new RestTemplate()));
    this.sockJsClient = new SockJsClient(transports);
}
Also used : RestTemplateXhrTransport(org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport) WsWebSocketContainer(org.apache.tomcat.websocket.WsWebSocketContainer) SockJsClient(org.springframework.web.socket.sockjs.client.SockJsClient) RestTemplate(org.springframework.web.client.RestTemplate) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient) Transport(org.springframework.web.socket.sockjs.client.Transport) WebSocketTransport(org.springframework.web.socket.sockjs.client.WebSocketTransport) RestTemplateXhrTransport(org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport) WebSocketTransport(org.springframework.web.socket.sockjs.client.WebSocketTransport) Before(org.junit.Before)

Example 2 with WsWebSocketContainer

use of org.apache.tomcat.websocket.WsWebSocketContainer in project spring-boot by spring-projects.

the class WebSocketMessagingAutoConfigurationTests method setup.

@BeforeEach
void setup() {
    List<Transport> transports = Arrays.asList(new WebSocketTransport(new StandardWebSocketClient(new WsWebSocketContainer())), new RestTemplateXhrTransport(new RestTemplate()));
    this.sockJsClient = new SockJsClient(transports);
}
Also used : RestTemplateXhrTransport(org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport) WsWebSocketContainer(org.apache.tomcat.websocket.WsWebSocketContainer) SockJsClient(org.springframework.web.socket.sockjs.client.SockJsClient) RestTemplate(org.springframework.web.client.RestTemplate) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient) Transport(org.springframework.web.socket.sockjs.client.Transport) WebSocketTransport(org.springframework.web.socket.sockjs.client.WebSocketTransport) RestTemplateXhrTransport(org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport) WebSocketTransport(org.springframework.web.socket.sockjs.client.WebSocketTransport) BeforeEach(org.junit.jupiter.api.BeforeEach)

Example 3 with WsWebSocketContainer

use of org.apache.tomcat.websocket.WsWebSocketContainer in project spring-boot by spring-projects.

the class LiveReloadServerTests method connect.

private LiveReloadWebSocketHandler connect() throws Exception {
    WebSocketClient client = new StandardWebSocketClient(new WsWebSocketContainer());
    LiveReloadWebSocketHandler handler = new LiveReloadWebSocketHandler();
    client.doHandshake(handler, "ws://localhost:" + this.port + "/livereload");
    handler.awaitHello();
    return handler;
}
Also used : WsWebSocketContainer(org.apache.tomcat.websocket.WsWebSocketContainer) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient) WebSocketClient(org.springframework.web.socket.client.WebSocketClient) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient)

Example 4 with WsWebSocketContainer

use of org.apache.tomcat.websocket.WsWebSocketContainer in project spring-boot by spring-projects.

the class LiveReloadServerTests method connect.

private LiveReloadWebSocketHandler connect(Function<WebSocketContainer, WebSocketClient> clientFactory) throws Exception {
    WsWebSocketContainer webSocketContainer = new WsWebSocketContainer();
    WebSocketClient client = clientFactory.apply(webSocketContainer);
    LiveReloadWebSocketHandler handler = new LiveReloadWebSocketHandler();
    client.doHandshake(handler, "ws://localhost:" + this.port + "/livereload");
    handler.awaitHello();
    return handler;
}
Also used : WsWebSocketContainer(org.apache.tomcat.websocket.WsWebSocketContainer) StandardWebSocketClient(org.springframework.web.socket.client.standard.StandardWebSocketClient) WebSocketClient(org.springframework.web.socket.client.WebSocketClient)

Aggregations

WsWebSocketContainer (org.apache.tomcat.websocket.WsWebSocketContainer)4 StandardWebSocketClient (org.springframework.web.socket.client.standard.StandardWebSocketClient)4 RestTemplate (org.springframework.web.client.RestTemplate)2 WebSocketClient (org.springframework.web.socket.client.WebSocketClient)2 RestTemplateXhrTransport (org.springframework.web.socket.sockjs.client.RestTemplateXhrTransport)2 SockJsClient (org.springframework.web.socket.sockjs.client.SockJsClient)2 Transport (org.springframework.web.socket.sockjs.client.Transport)2 WebSocketTransport (org.springframework.web.socket.sockjs.client.WebSocketTransport)2 Before (org.junit.Before)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1