chore(性能测试): 修复检查kafka的时候导致的kafka日志异常

This commit is contained in:
Captain.B 2021-07-13 16:53:53 +08:00 committed by 刘瑞斌
parent d34ab9113d
commit d6c9974065
1 changed files with 5 additions and 10 deletions

View File

@ -45,7 +45,6 @@ import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.net.Socket;
import java.nio.charset.StandardCharsets;
@ -318,15 +317,11 @@ public class PerformanceTestService {
//1,建立tcp
String ip = ipAndPort[0];
int port = Integer.parseInt(ipAndPort[1]);
try (
Socket soc = new Socket();
) {
soc.connect(new InetSocketAddress(ip, port), 1000); // 1s timeout
//2.输入内容
String content = "1010";
byte[] bs = content.getBytes();
OutputStream os = soc.getOutputStream();
os.write(bs);
//3.关闭
soc.close();
}
}
} catch (Exception e) {
LogUtil.error(e.getMessage(), e);