Package org.springframework.web.socket.handler

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


    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

    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

    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

    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

    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

    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

    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

Related Classes of org.springframework.web.socket.handler.TextWebSocketHandler

Copyright © 2018 www.massapicom. 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.