diff --git a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java index c8ef5c6b15..2cd2cbfc3b 100644 --- a/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java +++ b/backend/src/main/java/io/metersphere/performance/service/PerformanceTestService.java @@ -44,7 +44,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; @@ -315,15 +314,11 @@ public class PerformanceTestService { //1,建立tcp String ip = ipAndPort[0]; int port = Integer.parseInt(ipAndPort[1]); - 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(); + try ( + Socket soc = new Socket(); + ) { + soc.connect(new InetSocketAddress(ip, port), 1000); // 1s timeout + } } } catch (Exception e) { LogUtil.error(e.getMessage(), e); diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index c4caf9b812..eb18d32967 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -15,7 +15,6 @@ spring.datasource.hikari.connection-test-query=SELECT 1 #kafka spring.kafka.bootstrap-servers=${kafka.bootstrap-servers} spring.kafka.consumer.group-id=metersphere_group_id -spring.kafka.producer.properties.security.protocol=PLAINTEXT # mybatis mybatis.configuration.cache-enabled=true mybatis.configuration.lazy-loading-enabled=false