fix(接口测试): case执行收不到结果问题修复

--bug=1012793 --user=赵勇 【接口测试】接口定义-接口case中query参数值是json文件-执行多次卡住 https://www.tapd.cn/55049933/s/1148609
This commit is contained in:
fit2-zhao 2022-04-26 20:00:01 +08:00 committed by fit2-zhao
parent 77ca0e4002
commit 80960e06d2
2 changed files with 8 additions and 12 deletions

View File

@ -21,8 +21,7 @@ public class IndexWebSocket {
@OnOpen
public void openSession(@PathParam("reportId") String reportId, Session session) {
WebSocketUtils.ONLINE_USER_SESSIONS.put(reportId, session);
log.info("客户端: [" + reportId + "] : 连接成功!");
//WebSocketUtils.sendMessageAll("客户端: [" + reportId + "] : 连接成功!");
log.info("客户端: [" + reportId + "] : 连接成功!" + WebSocketUtils.ONLINE_USER_SESSIONS.size());
}
/**
@ -43,9 +42,8 @@ public class IndexWebSocket {
public void onClose(@PathParam("reportId") String reportId, Session session) throws IOException {
//当前的Session 移除
WebSocketUtils.ONLINE_USER_SESSIONS.remove(reportId);
log.info("[" + reportId + "] : 断开连接!");
log.info("[" + reportId + "] : 断开连接!" + WebSocketUtils.ONLINE_USER_SESSIONS.size());
//并且通知其他人当前用户已经断开连接了
//WebSocketUtils.sendMessageAll("[" + reportId + "] : 断开连接!");
session.close();
}

View File

@ -1,8 +1,6 @@
package io.metersphere.websocket.c.to.c;
import com.alibaba.fastjson.JSON;
import io.metersphere.commons.utils.LogUtil;
import io.metersphere.websocket.c.to.c.util.MsgDto;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
@ -10,23 +8,23 @@ import java.net.URI;
import java.net.URISyntaxException;
import java.util.Iterator;
public class MsWebSocketClient extends WebSocketClient{
public class MsWebSocketClient extends WebSocketClient {
public MsWebSocketClient(String url) throws URISyntaxException {
super(new URI(url));
}
@Override
public void onOpen(ServerHandshake shake) {
System.out.println("握手...");
for(Iterator<String> it=shake.iterateHttpFields();it.hasNext();) {
LogUtil.info("握手...");
for (Iterator<String> it = shake.iterateHttpFields(); it.hasNext(); ) {
String key = it.next();
System.out.println(key+":"+shake.getFieldValue(key));
System.out.println(key + ":" + shake.getFieldValue(key));
}
}
@Override
public void onMessage(String paramString) {
System.out.println("接收到消息:"+paramString);
System.out.println("接收到消息:" + paramString);
}
@Override
@ -36,6 +34,6 @@ public class MsWebSocketClient extends WebSocketClient{
@Override
public void onError(Exception e) {
System.out.println("异常"+e);
System.out.println("异常" + e);
}
}