|
@@ -11,6 +11,7 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
|
|
import java.net.URI;
|
|
|
+import java.util.UUID;
|
|
|
|
|
|
@Controller
|
|
|
@RequestMapping({"/ws/test/"})
|
|
@@ -24,7 +25,7 @@ public class WebSocketTestController {
|
|
|
@ResponseBody
|
|
|
public String star() {
|
|
|
try {
|
|
|
- String url = PropertiesUtil.getProperty("ws.url")+"zxdata987654+";
|
|
|
+ String url = PropertiesUtil.getProperty("ws.url")+ UUID.randomUUID().toString().replace("-","");
|
|
|
WsClient myClient = new WsClient(new URI(url));
|
|
|
myClient.connect();
|
|
|
while (!myClient.getReadyState().equals(WebSocket.READYSTATE.OPEN)) {
|
|
@@ -37,6 +38,25 @@ public class WebSocketTestController {
|
|
|
|
|
|
return "true";
|
|
|
}
|
|
|
+
|
|
|
+ @RequestMapping({"killws.do"})
|
|
|
+ @ResponseBody
|
|
|
+ public String killws() {
|
|
|
+ try {
|
|
|
+
|
|
|
+ String url = PropertiesUtil.getProperty("ws.url")+ UUID.randomUUID().toString().replace("-","");
|
|
|
+ WsClient myClient = new WsClient(new URI(url));
|
|
|
+ myClient.closeWebSocket();
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ return "true";
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
@RequestMapping({"test.do"})
|
|
|
@ResponseBody
|
|
|
public String star2() {
|