Java Code Examples for org.springframework.web.socket.sockjs.transport.TransportType#XHR

The following examples show how to use org.springframework.web.socket.sockjs.transport.TransportType#XHR . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ClientSockJsSessionTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
@Before
public void setup() throws Exception {
	SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("https://example.com"));
	Transport transport = mock(Transport.class);
	TransportRequest request = new DefaultTransportRequest(urlInfo, null, null, transport, TransportType.XHR, CODEC);
	this.handler = mock(WebSocketHandler.class);
	this.connectFuture = new SettableListenableFuture<>();
	this.session = new TestClientSockJsSession(request, this.handler, this.connectFuture);
}
 
Example 2
Source File: RestTemplateXhrTransportTests.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private ListenableFuture<WebSocketSession> connect(RestOperations restTemplate, ClientHttpResponse... responses)
		throws Exception {

	RestTemplateXhrTransport transport = new RestTemplateXhrTransport(restTemplate);
	transport.setTaskExecutor(new SyncTaskExecutor());

	SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("https://example.com"));
	HttpHeaders headers = new HttpHeaders();
	headers.add("h-foo", "h-bar");
	TransportRequest request = new DefaultTransportRequest(urlInfo, headers, headers,
			transport, TransportType.XHR, CODEC);

	return transport.connect(request, this.webSocketHandler);
}
 
Example 3
Source File: ClientSockJsSessionTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
@Before
public void setup() throws Exception {
	SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("http://example.com"));
	Transport transport = mock(Transport.class);
	TransportRequest request = new DefaultTransportRequest(urlInfo, null, null, transport, TransportType.XHR, CODEC);
	this.handler = mock(WebSocketHandler.class);
	this.connectFuture = new SettableListenableFuture<>();
	this.session = new TestClientSockJsSession(request, this.handler, this.connectFuture);
}
 
Example 4
Source File: RestTemplateXhrTransportTests.java    From java-technology-stack with MIT License 5 votes vote down vote up
private ListenableFuture<WebSocketSession> connect(RestOperations restTemplate, ClientHttpResponse... responses)
		throws Exception {

	RestTemplateXhrTransport transport = new RestTemplateXhrTransport(restTemplate);
	transport.setTaskExecutor(new SyncTaskExecutor());

	SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("http://example.com"));
	HttpHeaders headers = new HttpHeaders();
	headers.add("h-foo", "h-bar");
	TransportRequest request = new DefaultTransportRequest(urlInfo, headers, headers,
			transport, TransportType.XHR, CODEC);

	return transport.connect(request, this.webSocketHandler);
}
 
Example 5
Source File: ClientSockJsSessionTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
@Before
public void setup() throws Exception {
	SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("http://example.com"));
	Transport transport = mock(Transport.class);
	TransportRequest request = new DefaultTransportRequest(urlInfo, null, null, transport, TransportType.XHR, CODEC);
	this.handler = mock(WebSocketHandler.class);
	this.connectFuture = new SettableListenableFuture<>();
	this.session = new TestClientSockJsSession(request, this.handler, this.connectFuture);
}
 
Example 6
Source File: RestTemplateXhrTransportTests.java    From spring4-understanding with Apache License 2.0 5 votes vote down vote up
private ListenableFuture<WebSocketSession> connect(RestOperations restTemplate, ClientHttpResponse... responses)
		throws Exception {

	RestTemplateXhrTransport transport = new RestTemplateXhrTransport(restTemplate);
	transport.setTaskExecutor(new SyncTaskExecutor());

	SockJsUrlInfo urlInfo = new SockJsUrlInfo(new URI("http://example.com"));
	HttpHeaders headers = new HttpHeaders();
	headers.add("h-foo", "h-bar");
	TransportRequest request = new DefaultTransportRequest(urlInfo, headers, headers,
			transport, TransportType.XHR, CODEC);

	return transport.connect(request, this.webSocketHandler);
}
 
Example 7
Source File: XhrPollingTransportHandler.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
public TransportType getTransportType() {
	return TransportType.XHR;
}
 
Example 8
Source File: XhrPollingTransportHandler.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
public TransportType getTransportType() {
	return TransportType.XHR;
}
 
Example 9
Source File: XhrPollingTransportHandler.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
@Override
public TransportType getTransportType() {
	return TransportType.XHR;
}