Examples of TextWebSocketHandler


Examples of org.springframework.web.socket.handler.TextWebSocketHandler

  public void doHandshake() throws Exception {

    WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
    headers.setSecWebSocketProtocol(Arrays.asList("echo"));

    this.wsSession = this.client.doHandshake(new TextWebSocketHandler(), headers, new URI(this.wsUrl)).get();

    assertEquals(this.wsUrl, this.wsSession.getUri().toString());
    assertEquals("echo", this.wsSession.getAcceptedProtocol());
  }
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    WebSocketHttpHeaders headers = new WebSocketHttpHeaders();
    headers.setSecWebSocketProtocol(Arrays.asList("echo"));

    this.client.setTaskExecutor(new SimpleAsyncTaskExecutor());
    this.wsSession = this.client.doHandshake(new TextWebSocketHandler(), headers, new URI(this.wsUrl)).get();

    assertEquals(this.wsUrl, this.wsSession.getUri().toString());
    assertEquals("echo", this.wsSession.getAcceptedProtocol());
  }
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    this.registration = new TestWebSocketHandlerRegistration(taskScheduler);
  }

  @Test
  public void minimal() {
    WebSocketHandler handler = new TextWebSocketHandler();
    this.registration.addHandler(handler, "/foo", "/bar");

    List<Mapping> mappings = this.registration.getMappings();
    assertEquals(2, mappings.size());
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    assertEquals(0, m2.interceptors.length);
  }

  @Test
  public void interceptors() {
    WebSocketHandler handler = new TextWebSocketHandler();
    HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();

    this.registration.addHandler(handler, "/foo").addInterceptors(interceptor);

    List<Mapping> mappings = this.registration.getMappings();
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    assertArrayEquals(new HandshakeInterceptor[] {interceptor}, mapping.interceptors);
  }

  @Test
  public void interceptorsWithAllowedOrigins() {
    WebSocketHandler handler = new TextWebSocketHandler();
    HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();

    this.registration.addHandler(handler, "/foo").addInterceptors(interceptor).setAllowedOrigins("http://mydomain1.com");

    List<Mapping> mappings = this.registration.getMappings();
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    assertEquals(OriginHandshakeInterceptor.class, mapping.interceptors[1].getClass());
  }

  @Test
  public void interceptorsPassedToSockJsRegistration() {
    WebSocketHandler handler = new TextWebSocketHandler();
    HttpSessionHandshakeInterceptor interceptor = new HttpSessionHandshakeInterceptor();

    this.registration.addHandler(handler, "/foo").addInterceptors(interceptor)
        .setAllowedOrigins("http://mydomain1.com").withSockJS();
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    assertEquals(OriginHandshakeInterceptor.class, interceptors.get(1).getClass());
  }

  @Test
  public void handshakeHandler() {
    WebSocketHandler handler = new TextWebSocketHandler();
    HandshakeHandler handshakeHandler = new DefaultHandshakeHandler();

    this.registration.addHandler(handler, "/foo").setHandshakeHandler(handshakeHandler);

    List<Mapping> mappings = this.registration.getMappings();
View Full Code Here

Examples of org.springframework.web.socket.handler.TextWebSocketHandler

    assertSame(handshakeHandler, mapping.handshakeHandler);
  }

  @Test
  public void handshakeHandlerPassedToSockJsRegistration() {
    WebSocketHandler handler = new TextWebSocketHandler();
    HandshakeHandler handshakeHandler = new DefaultHandshakeHandler();

    this.registration.addHandler(handler, "/foo").setHandshakeHandler(handshakeHandler).withSockJS();

    List<Mapping> mappings = this.registration.getMappings();
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.