List of usage examples for org.springframework.web.socket WebSocketHttpHeaders WebSocketHttpHeaders
public WebSocketHttpHeaders()
From source file:gr.abiss.calipso.test.AbstractControllerIT.java
protected StompSession getStompSession(String url, Loggedincontext loginContext, StompSessionHandler sessionHandler, WebSocketHttpHeaders handshakeHeaders, StompHeaders connectHeaders) {//from w w w .j a v a 2s .co m if (sessionHandler == null) { sessionHandler = new DefaultStompSessionHandler(); } StompSession ownerSession = null; // add auth if (handshakeHeaders == null) { handshakeHeaders = new WebSocketHttpHeaders(); } handshakeHeaders.add("Authorization", "Basic " + loginContext.ssoToken); try { ownerSession = getWebSocketStompClient().connect(url, handshakeHeaders, connectHeaders, sessionHandler) .get(1, SECONDS); } catch (InterruptedException | ExecutionException | TimeoutException e) { throw new RuntimeException(e); } return ownerSession; }
From source file:org.springframework.web.socket.sockjs.client.AbstractSockJsIntegrationTests.java
@Test public void echoXhrWithHeaders() throws Exception { AbstractXhrTransport xhrTransport = createXhrTransport(); xhrTransport.setXhrStreamingDisabled(true); WebSocketHttpHeaders headers = new WebSocketHttpHeaders(); headers.add("auth", "123"); testEcho(10, xhrTransport, headers); for (Map.Entry<String, HttpHeaders> entry : this.testFilter.requests.entrySet()) { HttpHeaders httpHeaders = entry.getValue(); assertEquals("No auth header for: " + entry.getKey(), "123", httpHeaders.getFirst("auth")); }/* w w w . j av a 2s . c o m*/ }