Add websocket-undertow smoke test

Closes gh-73
This commit is contained in:
Andy Wilkinson
2022-09-13 15:54:44 +01:00
parent a54be44ecc
commit ea0ac3b2e5
10 changed files with 228 additions and 0 deletions

View File

@@ -0,0 +1,31 @@
package com.example.websocket.undertow;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.socket.client.WebSocketClient;
import org.springframework.web.socket.client.standard.StandardWebSocketClient;
import org.springframework.web.socket.config.annotation.EnableWebSocket;
import org.springframework.web.socket.config.annotation.WebSocketConfigurer;
import org.springframework.web.socket.config.annotation.WebSocketHandlerRegistry;
@Configuration
@EnableWebSocket
public class WebSocketConfig implements WebSocketConfigurer {
private final EchoWebSocketHandler echoWebSocketHandler;
public WebSocketConfig(EchoWebSocketHandler echoWebSocketHandler) {
this.echoWebSocketHandler = echoWebSocketHandler;
}
@Override
public void registerWebSocketHandlers(WebSocketHandlerRegistry registry) {
registry.addHandler(this.echoWebSocketHandler, "/echo");
}
@Bean
public WebSocketClient webSocketClient() {
return new StandardWebSocketClient();
}
}