Examples of afterConnectionEstablished()


Examples of com.music.web.websocket.GameHandler.afterConnectionEstablished()

        playerJoinMsg.setGameId(game.getId());

        getSession("1");
        WebSocketSession player2Session = getSession("2");

        handler.afterConnectionEstablished(player2Session);

        handler.handleMessage(player2Session, getTextMessage(playerJoinMsg));

        GameEvent playerJoinedEvent = mapper.readValue(messages.get("1").removeLast().getPayload().toString(), GameEvent.class);
        Assert.assertEquals(GameEventType.PLAYER_JOINED, playerJoinedEvent.getType());
View Full Code Here

Examples of org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished()

    SimpleUrlHandlerMapping mapping = (SimpleUrlHandlerMapping) config.getBean("stompWebSocketHandlerMapping");
    WebSocketHttpRequestHandler httpHandler = (WebSocketHttpRequestHandler) mapping.getHandlerMap().get("/test");
    handler = httpHandler.getWebSocketHandler();

    WebSocketSession session = new TestWebSocketSession("id");
    handler.afterConnectionEstablished(session);
    assertEquals(true, session.getAttributes().get("decorated"));
  }


  private ApplicationContext createConfig(Class<?>... configClasses) {
View Full Code Here

Examples of org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished()

  @Override
  public void afterConnectionEstablished(WebSocketSession session) throws Exception {
    WebSocketHandler handler = this.provider.getHandler();
    this.handlers.put(session, handler);
    handler.afterConnectionEstablished(session);
  }

  @Override
  public void handleMessage(WebSocketSession session, WebSocketMessage<?> message) throws Exception {
    getHandler(session).handleMessage(session, message);
View Full Code Here

Examples of org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished()

    @Test
    public void decorateAfterConnectionEstablished() throws Exception {
        WebSocketHandler decorated = factory.decorate(delegate);

        decorated.afterConnectionEstablished(session);

        verify(eventPublisher).publishEvent(event.capture());
        assertThat(event.getValue().getWebSocketSession()).isSameAs(session);
    }
View Full Code Here

Examples of org.springframework.web.socket.WebSocketHandler.afterConnectionEstablished()

    @Test
    public void decorateAfterConnectionEstablishedEventError() throws Exception {
        WebSocketHandler decorated = factory.decorate(delegate);
        doThrow(new IllegalStateException("Test throw on publishEvent")).when(eventPublisher).publishEvent(any(ApplicationEvent.class));

        decorated.afterConnectionEstablished(session);

        verify(eventPublisher).publishEvent(any(SessionConnectEvent.class));
    }
}
View Full Code Here

Examples of org.springframework.web.socket.messaging.SubProtocolWebSocketHandler.afterConnectionEstablished()

    List<ChannelInterceptor> interceptors = channel.getInterceptors();
    assertEquals(ImmutableMessageChannelInterceptor.class, interceptors.get(interceptors.size()-1).getClass());

    WebSocketSession session = new TestWebSocketSession("s1");
    webSocketHandler.afterConnectionEstablished(session);

    TextMessage textMessage = StompTextMessageBuilder.create(StompCommand.SEND).headers("destination:/foo").build();
    webSocketHandler.handleMessage(session, textMessage);

    Message<?> message = channel.messages.get(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.