Search in sources :

Example 1 with AbstractWebSocketHandler

use of org.springframework.web.socket.handler.AbstractWebSocketHandler in project spring-framework by spring-projects.

the class WebSocketConfigurationTests method registerWebSocketHandler.

@Test
public void registerWebSocketHandler() throws Exception {
    WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {
    }, getWsBaseUrl() + "/ws").get();
    TestHandler serverHandler = this.wac.getBean(TestHandler.class);
    assertTrue(serverHandler.connectLatch.await(2, TimeUnit.SECONDS));
    session.close();
}
Also used : AbstractWebSocketHandler(org.springframework.web.socket.handler.AbstractWebSocketHandler) WebSocketSession(org.springframework.web.socket.WebSocketSession) Test(org.junit.Test)

Example 2 with AbstractWebSocketHandler

use of org.springframework.web.socket.handler.AbstractWebSocketHandler in project spring-framework by spring-projects.

the class StandardWebSocketClientTests method setup.

@Before
public void setup() {
    this.headers = new WebSocketHttpHeaders();
    this.wsHandler = new AbstractWebSocketHandler() {
    };
    this.wsContainer = mock(WebSocketContainer.class);
    this.wsClient = new StandardWebSocketClient(this.wsContainer);
}
Also used : WebSocketContainer(javax.websocket.WebSocketContainer) AbstractWebSocketHandler(org.springframework.web.socket.handler.AbstractWebSocketHandler) WebSocketHttpHeaders(org.springframework.web.socket.WebSocketHttpHeaders) Before(org.junit.Before)

Example 3 with AbstractWebSocketHandler

use of org.springframework.web.socket.handler.AbstractWebSocketHandler in project spring-framework by spring-projects.

the class WebSocketConfigurationTests method registerWebSocketHandlerWithSockJS.

@Test
public void registerWebSocketHandlerWithSockJS() throws Exception {
    WebSocketSession session = this.webSocketClient.doHandshake(new AbstractWebSocketHandler() {
    }, getWsBaseUrl() + "/sockjs/websocket").get();
    TestHandler serverHandler = this.wac.getBean(TestHandler.class);
    assertTrue(serverHandler.connectLatch.await(2, TimeUnit.SECONDS));
    session.close();
}
Also used : AbstractWebSocketHandler(org.springframework.web.socket.handler.AbstractWebSocketHandler) WebSocketSession(org.springframework.web.socket.WebSocketSession) Test(org.junit.Test)

Aggregations

AbstractWebSocketHandler (org.springframework.web.socket.handler.AbstractWebSocketHandler)3 Test (org.junit.Test)2 WebSocketSession (org.springframework.web.socket.WebSocketSession)2 WebSocketContainer (javax.websocket.WebSocketContainer)1 Before (org.junit.Before)1 WebSocketHttpHeaders (org.springframework.web.socket.WebSocketHttpHeaders)1