From 3b53718b73c1ce803747e01522162b640299bcd1 Mon Sep 17 00:00:00 2001 From: liuyu Date: Mon, 12 Aug 2024 21:57:49 +0800 Subject: [PATCH] =?UTF-8?q?v2.1=20=E8=B0=83=E6=95=B4=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E7=BB=93=E6=9E=84=EF=BC=8C=E6=94=AF=E6=8C=81native=E6=89=93?= =?UTF-8?q?=E5=8C=85=EF=BC=9BclientId=E6=A0=A1=E9=AA=8C=E7=BC=BA=E9=99=B7?= =?UTF-8?q?=E8=B0=83=E6=95=B4=E4=B8=BA=E7=94=A8=E6=88=B7=E5=90=8D=E3=80=81?= =?UTF-8?q?=E5=AF=86=E7=A0=81=E6=A0=A1=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- META-INF/native-image/.lock | 1 + common/pom.xml | 60 - common/src/main/resources/log4j2.xml | 28 - common/src/test/resources/log4j2.xml | 23 - pom.xml | 2 +- readme.md | 91 +- run/pom.xml | 68 +- .../hppt/common/client/ClientBytesSender.java | 0 .../hppt/common/client/ClientSession.java | 0 .../common/client/ClientSessionLifecycle.java | 0 .../common/client/ClientSessionManager.java | 0 .../client/ClientSessionManagerBuilder.java | 0 .../hppt/common/client/ClientTalker.java | 0 .../hppt/common/pojo/SessionBytes.java | 0 .../hppt/common/protobuf/ProtoMessage.java | 0 .../common/server/LoginClientService.java | 0 .../hppt/common/server/ServerSession.java | 0 .../common/server/ServerSessionLifecycle.java | 0 .../common/server/ServerSessionManager.java | 0 .../server/ServerSessionManagerBuilder.java | 0 .../hppt/common/server/ServerTalker.java | 0 .../hppt/common/util/AesCipherUtil.java | 0 .../wowtools/hppt/common/util/BytesUtil.java | 2 +- .../hppt/common/util/CommonConfig.java | 0 .../wowtools/hppt/common/util/Constant.java | 0 .../hppt/common/util/DirChangeWatcher.java | 0 .../hppt/common/util/DisableTraceFilter.java | 25 + .../hppt/common/util/FileConsumerBuffer.java | 0 .../hppt/common/util/FileProducerBuffer.java | 0 .../hppt/common/util/GridAesCipherUtil.java | 0 .../wowtools/hppt/common/util/HttpUtil.java | 4 +- .../wowtools/hppt/common/util/JsonConfig.java | 0 .../common/util/NettyChannelTypeChecker.java | 0 .../hppt/common/util/ResourcesReader.java | 69 ++ .../hppt/common/util/RoughTimeUtil.java | 0 .../main/java/org/wowtools/hppt/run/Run.java | 23 +- .../java/org/wowtools/hppt/run/sc/RunSc.java | 6 +- .../sc/rpost/RPostClientSessionService.java | 16 +- .../java/org/wowtools/hppt/run/ss/RunSs.java | 11 +- .../run/ss/post/PostServerSessionService.java | 20 +- .../transport/PostServerTransport.java | 3 +- .../META-INF/native-image/jni-config.json | 27 + .../predefined-classes-config.json | 4 + .../META-INF/native-image/reflect-config.json | 1032 +++++++++++++++++ .../native-image/resource-config.json | 44 + .../native-image/serialization-config.json | 5 + run/src/main/resources/log4j2.xml | 28 - run/src/main/resources/logback.xml | 37 + .../src/test/java/nettytest/NettyClient.java | 0 .../src/test/java/nettytest/NettyServer.java | 0 .../client/ClientSessionManagerTest.java | 0 .../server/ServerSessionManagerTest.java | 2 +- .../hppt/common/util/AesCipherUtilTest.java | 0 .../hppt/common/util/BytesUtilTest.java | 0 .../common/util/GridAesCipherUtilTest.java | 0 .../hppt/run/ss/post/CombinedServer.java | 173 +++ .../src/test/java/t1/BytesCallBack.java | 0 .../src/test/java/t1/ClientPort.java | 0 .../src/test/java/t1/ClientSession.java | 0 .../test/java/t1/ClientSessionManager.java | 0 .../src/test/java/t1/ServerPort.java | 0 .../src/test/java/t1/ServerSession.java | 0 .../test/java/t1/ServerSessionManager.java | 0 .../src/test/java/t1/SessionBytes.java | 0 {common => run}/src/test/java/t1/Test.java | 0 .../test/ByteArrayCompressionExample.java | 0 .../test/java/test/LZ4CompressionExample.java | 0 .../src/test/java/test/ReadYmlConfig.java | 2 +- .../src/test/java/test/SimpleNettyClient.java | 0 .../src/test/java/test/SimpleNettyServer.java | 0 .../java/test/SymmetricEncryptionExample.java | 0 .../test/java/test/TCPForwardingServer.java | 0 72 files changed, 1584 insertions(+), 222 deletions(-) create mode 100644 META-INF/native-image/.lock delete mode 100644 common/pom.xml delete mode 100644 common/src/main/resources/log4j2.xml delete mode 100644 common/src/test/resources/log4j2.xml rename {common => run}/src/main/java/org/wowtools/hppt/common/client/ClientBytesSender.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/client/ClientSession.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/client/ClientSessionLifecycle.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/client/ClientSessionManager.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/client/ClientSessionManagerBuilder.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/client/ClientTalker.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/pojo/SessionBytes.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/protobuf/ProtoMessage.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/server/ServerSession.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/server/ServerSessionLifecycle.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/server/ServerSessionManager.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/server/ServerSessionManagerBuilder.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/AesCipherUtil.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java (99%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/CommonConfig.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/Constant.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/DirChangeWatcher.java (100%) create mode 100644 run/src/main/java/org/wowtools/hppt/common/util/DisableTraceFilter.java rename {common => run}/src/main/java/org/wowtools/hppt/common/util/FileConsumerBuffer.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/FileProducerBuffer.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/GridAesCipherUtil.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java (98%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/JsonConfig.java (100%) rename {common => run}/src/main/java/org/wowtools/hppt/common/util/NettyChannelTypeChecker.java (100%) create mode 100644 run/src/main/java/org/wowtools/hppt/common/util/ResourcesReader.java rename {common => run}/src/main/java/org/wowtools/hppt/common/util/RoughTimeUtil.java (100%) create mode 100644 run/src/main/resources/META-INF/native-image/jni-config.json create mode 100644 run/src/main/resources/META-INF/native-image/predefined-classes-config.json create mode 100644 run/src/main/resources/META-INF/native-image/reflect-config.json create mode 100644 run/src/main/resources/META-INF/native-image/resource-config.json create mode 100644 run/src/main/resources/META-INF/native-image/serialization-config.json delete mode 100644 run/src/main/resources/log4j2.xml create mode 100644 run/src/main/resources/logback.xml rename {common => run}/src/test/java/nettytest/NettyClient.java (100%) rename {common => run}/src/test/java/nettytest/NettyServer.java (100%) rename {common => run}/src/test/java/org/wowtools/hppt/common/client/ClientSessionManagerTest.java (100%) rename {common => run}/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java (95%) rename {common => run}/src/test/java/org/wowtools/hppt/common/util/AesCipherUtilTest.java (100%) rename {common => run}/src/test/java/org/wowtools/hppt/common/util/BytesUtilTest.java (100%) rename {common => run}/src/test/java/org/wowtools/hppt/common/util/GridAesCipherUtilTest.java (100%) create mode 100644 run/src/test/java/org/wowtools/hppt/run/ss/post/CombinedServer.java rename {common => run}/src/test/java/t1/BytesCallBack.java (100%) rename {common => run}/src/test/java/t1/ClientPort.java (100%) rename {common => run}/src/test/java/t1/ClientSession.java (100%) rename {common => run}/src/test/java/t1/ClientSessionManager.java (100%) rename {common => run}/src/test/java/t1/ServerPort.java (100%) rename {common => run}/src/test/java/t1/ServerSession.java (100%) rename {common => run}/src/test/java/t1/ServerSessionManager.java (100%) rename {common => run}/src/test/java/t1/SessionBytes.java (100%) rename {common => run}/src/test/java/t1/Test.java (100%) rename {common => run}/src/test/java/test/ByteArrayCompressionExample.java (100%) rename {common => run}/src/test/java/test/LZ4CompressionExample.java (100%) rename {common => run}/src/test/java/test/ReadYmlConfig.java (95%) rename {common => run}/src/test/java/test/SimpleNettyClient.java (100%) rename {common => run}/src/test/java/test/SimpleNettyServer.java (100%) rename {common => run}/src/test/java/test/SymmetricEncryptionExample.java (100%) rename {common => run}/src/test/java/test/TCPForwardingServer.java (100%) diff --git a/META-INF/native-image/.lock b/META-INF/native-image/.lock new file mode 100644 index 0000000..b83b06a --- /dev/null +++ b/META-INF/native-image/.lock @@ -0,0 +1 @@ +22916 \ No newline at end of file diff --git a/common/pom.xml b/common/pom.xml deleted file mode 100644 index 4a251d3..0000000 --- a/common/pom.xml +++ /dev/null @@ -1,60 +0,0 @@ - - - 4.0.0 - - org.wowtools.hppt - hppt - 1.0-SNAPSHOT - - - common - - - - com.squareup.okhttp3 - okhttp - - - org.lz4 - lz4-java - 1.8.0 - test - - - com.fasterxml.jackson.dataformat - jackson-dataformat-yaml - - - io.netty - netty-all - - - org.apache.logging.log4j - log4j-slf4j2-impl - - - - org.apache.logging.log4j - log4j-core - - - org.projectlombok - lombok - - - com.google.protobuf - protobuf-java - - - com.fasterxml.jackson.core - jackson-databind - - - org.wowtools - catframe-common - - - - diff --git a/common/src/main/resources/log4j2.xml b/common/src/main/resources/log4j2.xml deleted file mode 100644 index b270ea0..0000000 --- a/common/src/main/resources/log4j2.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - %d{MM-dd HH:mm:ss} [%t] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - - - - - diff --git a/common/src/test/resources/log4j2.xml b/common/src/test/resources/log4j2.xml deleted file mode 100644 index ff635f0..0000000 --- a/common/src/test/resources/log4j2.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - %d{HH:mm:ss.SSS} [%t] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - diff --git a/pom.xml b/pom.xml index b450300..9ef1fdc 100644 --- a/pom.xml +++ b/pom.xml @@ -11,7 +11,6 @@ - common run _localtest kafkademo @@ -19,6 +18,7 @@ 21 + 0.10.2 ${java.version} ${java.version} UTF-8 diff --git a/readme.md b/readme.md index ea27fc0..2c82a8f 100644 --- a/readme.md +++ b/readme.md @@ -14,10 +14,23 @@ hppt,一款可通过任意协议转发tcp端口的工具。 ![hppt](_doc/img/1.jpg) # 快速开始 +在[releases](https://github.com/codingmiao/hppt/releases) +页面下载最新版本编译好的hppt,或自行下载源码编译。 +```shell +#jar +mvn clean package -DskipTests + +#可选操作 打native包 +su graalvm +cd run +mvn org.graalvm.buildtools:native-maven-plugin:build +``` -本项目需要jdk21启动,请先前往[jdk官网](https://jdk.java.net/21/) -下载对应你操作系统版本的jdk,然后在[releases](https://github.com/codingmiao/hppt/releases) -页面下载最新版本编译好的hppt.zip,或自行下载源码编译 +本项目编译成了可执行文件及jar包。 + +可执行文件无环境依赖、内存占用,小单因为没有jit支持,性能略逊于jar包执行; + +jar包执行性能更好,但多消耗一些内存,如需jar包执行,请先前往[jdk官网](https://jdk.java.net/archive/)下载对应你操作系统版本的jdk21。 ## 示例1 通过http端口,反向代理访问内部服务器SSH端口 @@ -25,7 +38,7 @@ hppt,一款可通过任意协议转发tcp端口的工具。 ![示例1](_doc/img/3.jpg) -1、在集群中任一服务器上新建一个hppt目录,并上传hppt.jar、ss.yml、log4j2.xml文件到此目录下: +1、在集群中任一服务器上新建一个hppt目录,并上传hppt.jar(也可用可执行文件 hppt.ext 或 hppt)、ss.yml、log4j2.xml文件到此目录下: ``` hppt @@ -41,23 +54,43 @@ hppt type: post #服务http端口 port: 20871 -# 允许的客户端id -clientIds: - - user1 - - user2 +# 允许的客户端账号和密码 +clients: + - user: user1 + password: 12345 + - user: user2 + password: 112233 ``` (注1:作为快速演示,这里的type选择了最简单的post类型,此场景下最佳性能的协议为websocket,或是有独立端口的话可以配置hppt协议,ws、hppt版的说明奋力码字中。。) (注2:实际应用中,为了确保安全,建议把clientId设置得更复杂一些) -执行如下命令运行服务端的hppt +执行如下命令运行服务端的hppt(3选1) +jar包运行 ```shell cd hppt /bin/java -jar hppt.jar ss ss.yml ``` +windows下可执行文件运行 +```shell +cd hppt +chcp 65001 +title "hppt" +hppt.exe ss ss.yml +pause +``` + +linux下可执行文件运行 +```shell +cd hppt +./hppt ss ss.yml +#后台运行用命令 nohup ./hppt ss ss.yml >/dev/null & +``` + + 在nginx上增加一段配置指向hppt ``` @@ -87,8 +120,10 @@ hppt ```yaml # 和服务端的type保持一致 type: post -# 客户端id,必须在服务端的clientIds列表里才能成功连接,每个客户端用一个id,不要重复 -clientId: user1 +# 客户端用户名,每个sc进程用一个,不要重复 +clientUser: user1 +# 客户端密码 +clientPassword: 12345 post: # 服务端http地址,如无法直连,用nginx代理几次填nginx的地址也ok @@ -108,13 +143,30 @@ forwards: ``` -执行如下命令启动客户端的hppt +执行如下命令启动客户端的hppt(3选1) +jar包运行 ```shell cd hppt /bin/java -jar hppt.jar sc sc.yml ``` +windows下可执行文件运行 +```shell +cd hppt +chcp 65001 +title "hppt" +hppt.exe sc sc.yml +pause +``` + +linux下可执行文件运行 +```shell +cd hppt +./hppt sc sc.yml +#后台运行用命令 nohup ./hppt ss ss.yml >/dev/null & +``` + 随后,你就可以在公司用linux连接工具访问localhost的10022端口,来登录应用服务器了 @@ -138,8 +190,10 @@ hppt ```yaml # 通讯协议 本示例使用了性能最好的hppt协议,加r前缀表示客户端和服务端角色互换。这里也可以配http post或websocket type: rhppt -# 客户端id -clientId: user1 +# 客户端用户名,每个sc进程用一个,不要重复 +clientUser: user1 +# 客户端密码 +clientPassword: 12345 # 服务端口 rhppt: @@ -185,9 +239,12 @@ rhppt: host: "111.222.33.44" port: 20871 -# 对应的的客户端id -clientIds: - - user1 +# 允许的客户端账号和密码 +clients: + - user: user1 + password: 12345 + - user: user2 + password: 112233 ``` diff --git a/run/pom.xml b/run/pom.xml index c2e7574..74a3d37 100644 --- a/run/pom.xml +++ b/run/pom.xml @@ -12,16 +12,48 @@ run - org.wowtools.hppt - common - 1.0-SNAPSHOT - compile + com.squareup.okhttp3 + okhttp + + + org.lz4 + lz4-java + 1.8.0 + test + + + com.fasterxml.jackson.dataformat + jackson-dataformat-yaml + + + io.netty + netty-all + + + org.projectlombok + lombok + + + ch.qos.logback + logback-classic + 1.4.11 + + + com.google.protobuf + protobuf-java + + + com.fasterxml.jackson.core + jackson-databind + + + org.wowtools + catframe-common org.eclipse.jetty.toolchain jetty-jakarta-servlet-api 5.0.2 - compile org.eclipse.jetty @@ -83,7 +115,33 @@ + + + org.graalvm.buildtools + native-maven-plugin + ${native.maven.plugin.version} + + + -H:+AddAllCharsets + + org.wowtools.hppt.run.Run + hppt + + + + + graalvm-native-build-tools-snapshots + GraalVM native-build-tools Snapshots + https://raw.githubusercontent.com/graalvm/native-build-tools/snapshots + + false + + + true + + + diff --git a/common/src/main/java/org/wowtools/hppt/common/client/ClientBytesSender.java b/run/src/main/java/org/wowtools/hppt/common/client/ClientBytesSender.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/client/ClientBytesSender.java rename to run/src/main/java/org/wowtools/hppt/common/client/ClientBytesSender.java diff --git a/common/src/main/java/org/wowtools/hppt/common/client/ClientSession.java b/run/src/main/java/org/wowtools/hppt/common/client/ClientSession.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/client/ClientSession.java rename to run/src/main/java/org/wowtools/hppt/common/client/ClientSession.java diff --git a/common/src/main/java/org/wowtools/hppt/common/client/ClientSessionLifecycle.java b/run/src/main/java/org/wowtools/hppt/common/client/ClientSessionLifecycle.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/client/ClientSessionLifecycle.java rename to run/src/main/java/org/wowtools/hppt/common/client/ClientSessionLifecycle.java diff --git a/common/src/main/java/org/wowtools/hppt/common/client/ClientSessionManager.java b/run/src/main/java/org/wowtools/hppt/common/client/ClientSessionManager.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/client/ClientSessionManager.java rename to run/src/main/java/org/wowtools/hppt/common/client/ClientSessionManager.java diff --git a/common/src/main/java/org/wowtools/hppt/common/client/ClientSessionManagerBuilder.java b/run/src/main/java/org/wowtools/hppt/common/client/ClientSessionManagerBuilder.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/client/ClientSessionManagerBuilder.java rename to run/src/main/java/org/wowtools/hppt/common/client/ClientSessionManagerBuilder.java diff --git a/common/src/main/java/org/wowtools/hppt/common/client/ClientTalker.java b/run/src/main/java/org/wowtools/hppt/common/client/ClientTalker.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/client/ClientTalker.java rename to run/src/main/java/org/wowtools/hppt/common/client/ClientTalker.java diff --git a/common/src/main/java/org/wowtools/hppt/common/pojo/SessionBytes.java b/run/src/main/java/org/wowtools/hppt/common/pojo/SessionBytes.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/pojo/SessionBytes.java rename to run/src/main/java/org/wowtools/hppt/common/pojo/SessionBytes.java diff --git a/common/src/main/java/org/wowtools/hppt/common/protobuf/ProtoMessage.java b/run/src/main/java/org/wowtools/hppt/common/protobuf/ProtoMessage.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/protobuf/ProtoMessage.java rename to run/src/main/java/org/wowtools/hppt/common/protobuf/ProtoMessage.java diff --git a/common/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java b/run/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java rename to run/src/main/java/org/wowtools/hppt/common/server/LoginClientService.java diff --git a/common/src/main/java/org/wowtools/hppt/common/server/ServerSession.java b/run/src/main/java/org/wowtools/hppt/common/server/ServerSession.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/server/ServerSession.java rename to run/src/main/java/org/wowtools/hppt/common/server/ServerSession.java diff --git a/common/src/main/java/org/wowtools/hppt/common/server/ServerSessionLifecycle.java b/run/src/main/java/org/wowtools/hppt/common/server/ServerSessionLifecycle.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/server/ServerSessionLifecycle.java rename to run/src/main/java/org/wowtools/hppt/common/server/ServerSessionLifecycle.java diff --git a/common/src/main/java/org/wowtools/hppt/common/server/ServerSessionManager.java b/run/src/main/java/org/wowtools/hppt/common/server/ServerSessionManager.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/server/ServerSessionManager.java rename to run/src/main/java/org/wowtools/hppt/common/server/ServerSessionManager.java diff --git a/common/src/main/java/org/wowtools/hppt/common/server/ServerSessionManagerBuilder.java b/run/src/main/java/org/wowtools/hppt/common/server/ServerSessionManagerBuilder.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/server/ServerSessionManagerBuilder.java rename to run/src/main/java/org/wowtools/hppt/common/server/ServerSessionManagerBuilder.java diff --git a/common/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java b/run/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java rename to run/src/main/java/org/wowtools/hppt/common/server/ServerTalker.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/AesCipherUtil.java b/run/src/main/java/org/wowtools/hppt/common/util/AesCipherUtil.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/AesCipherUtil.java rename to run/src/main/java/org/wowtools/hppt/common/util/AesCipherUtil.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java b/run/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java similarity index 99% rename from common/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java rename to run/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java index 4577208..6842b52 100644 --- a/common/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java +++ b/run/src/main/java/org/wowtools/hppt/common/util/BytesUtil.java @@ -145,7 +145,7 @@ private static boolean afterWrite(ChannelFuture future, Object msg) { } private static void waitChannelWritable(Channel channel) { - while (!channel.isWritable()) { + while (!channel.isWritable() && channel.isOpen()) { try { Thread.sleep(200); } catch (InterruptedException e) { diff --git a/common/src/main/java/org/wowtools/hppt/common/util/CommonConfig.java b/run/src/main/java/org/wowtools/hppt/common/util/CommonConfig.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/CommonConfig.java rename to run/src/main/java/org/wowtools/hppt/common/util/CommonConfig.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/Constant.java b/run/src/main/java/org/wowtools/hppt/common/util/Constant.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/Constant.java rename to run/src/main/java/org/wowtools/hppt/common/util/Constant.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/DirChangeWatcher.java b/run/src/main/java/org/wowtools/hppt/common/util/DirChangeWatcher.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/DirChangeWatcher.java rename to run/src/main/java/org/wowtools/hppt/common/util/DirChangeWatcher.java diff --git a/run/src/main/java/org/wowtools/hppt/common/util/DisableTraceFilter.java b/run/src/main/java/org/wowtools/hppt/common/util/DisableTraceFilter.java new file mode 100644 index 0000000..1686190 --- /dev/null +++ b/run/src/main/java/org/wowtools/hppt/common/util/DisableTraceFilter.java @@ -0,0 +1,25 @@ +package org.wowtools.hppt.common.util; + +import jakarta.servlet.*; +import jakarta.servlet.http.HttpServletRequest; +import jakarta.servlet.http.HttpServletResponse; + +import java.io.IOException; + +/** + * @author liuyu + * @date 2024/8/10 + */ +public class DisableTraceFilter implements Filter { + @Override + public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { + HttpServletRequest httpRequest = (HttpServletRequest) request; + String m = httpRequest.getMethod(); + if ("TRACE".equalsIgnoreCase(m) || "TRACK".equalsIgnoreCase(m)) { + HttpServletResponse httpResponse = (HttpServletResponse) response; + httpResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); + return; + } + chain.doFilter(request, response); + } +} diff --git a/common/src/main/java/org/wowtools/hppt/common/util/FileConsumerBuffer.java b/run/src/main/java/org/wowtools/hppt/common/util/FileConsumerBuffer.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/FileConsumerBuffer.java rename to run/src/main/java/org/wowtools/hppt/common/util/FileConsumerBuffer.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/FileProducerBuffer.java b/run/src/main/java/org/wowtools/hppt/common/util/FileProducerBuffer.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/FileProducerBuffer.java rename to run/src/main/java/org/wowtools/hppt/common/util/FileProducerBuffer.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/GridAesCipherUtil.java b/run/src/main/java/org/wowtools/hppt/common/util/GridAesCipherUtil.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/GridAesCipherUtil.java rename to run/src/main/java/org/wowtools/hppt/common/util/GridAesCipherUtil.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java b/run/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java similarity index 98% rename from common/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java rename to run/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java index fbc5ab6..eaddc8f 100644 --- a/common/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java +++ b/run/src/main/java/org/wowtools/hppt/common/util/HttpUtil.java @@ -8,15 +8,13 @@ import javax.net.ssl.TrustManager; import javax.net.ssl.X509TrustManager; import java.io.IOException; -import java.net.InetSocketAddress; +import java.nio.charset.Charset; import java.security.KeyManagementException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; import java.security.cert.X509Certificate; import java.util.concurrent.TimeUnit; -import java.net.Proxy; - /** * @author liuyu * @date 2023/12/22 diff --git a/common/src/main/java/org/wowtools/hppt/common/util/JsonConfig.java b/run/src/main/java/org/wowtools/hppt/common/util/JsonConfig.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/JsonConfig.java rename to run/src/main/java/org/wowtools/hppt/common/util/JsonConfig.java diff --git a/common/src/main/java/org/wowtools/hppt/common/util/NettyChannelTypeChecker.java b/run/src/main/java/org/wowtools/hppt/common/util/NettyChannelTypeChecker.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/NettyChannelTypeChecker.java rename to run/src/main/java/org/wowtools/hppt/common/util/NettyChannelTypeChecker.java diff --git a/run/src/main/java/org/wowtools/hppt/common/util/ResourcesReader.java b/run/src/main/java/org/wowtools/hppt/common/util/ResourcesReader.java new file mode 100644 index 0000000..e7b6dae --- /dev/null +++ b/run/src/main/java/org/wowtools/hppt/common/util/ResourcesReader.java @@ -0,0 +1,69 @@ +package org.wowtools.hppt.common.util; + +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.net.URISyntaxException; +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Paths; + +/** + * @author liuyu + * @date 2024/8/7 + */ +public class ResourcesReader { + /** + * 获得项目根路径 + * + * @param clazz 定位用的类 + * @return + */ + public static String getRootPath(Class clazz){ + File currentFile; + try { + currentFile = new File(clazz.getProtectionDomain().getCodeSource().getLocation().toURI()); + } catch (URISyntaxException e) { + throw new RuntimeException(e); + } + String currentDir; + if (currentFile.getName().endsWith("classes")) { + //开发环境下,目录在target\classes下 + currentDir = currentFile.getPath(); + }else { + currentDir = currentFile.getParent(); + } + return currentDir; + } + + /** + * 读取类所处根目录下的文件路径加上path的文件内容为String + * + * @param clazz 定位用的类 + * @param path 类根路径下的相对路径 + * @return + */ + public static String readStr(Class clazz, String path) { + try { + String basePath = getRootPath(clazz); + return readStr(basePath + "/" + path); + } catch (Exception e) { + throw new RuntimeException("读取配置文件异常", e); + } + } + + /** + * 读取绝对路径下的文件的文件内容为String + * + * @param path 绝对路径 + * @return + */ + public static String readStr(String path) { + // 读取文件内容为字符串 + try { + return Files.readString(Paths.get(path)); + } catch (IOException e) { + throw new RuntimeException(e); + } + } +} diff --git a/common/src/main/java/org/wowtools/hppt/common/util/RoughTimeUtil.java b/run/src/main/java/org/wowtools/hppt/common/util/RoughTimeUtil.java similarity index 100% rename from common/src/main/java/org/wowtools/hppt/common/util/RoughTimeUtil.java rename to run/src/main/java/org/wowtools/hppt/common/util/RoughTimeUtil.java diff --git a/run/src/main/java/org/wowtools/hppt/run/Run.java b/run/src/main/java/org/wowtools/hppt/run/Run.java index 149b538..e86e863 100644 --- a/run/src/main/java/org/wowtools/hppt/run/Run.java +++ b/run/src/main/java/org/wowtools/hppt/run/Run.java @@ -1,10 +1,16 @@ package org.wowtools.hppt.run; +import ch.qos.logback.classic.LoggerContext; +import ch.qos.logback.classic.joran.JoranConfigurator; +import ch.qos.logback.core.util.StatusPrinter; import io.netty.util.ResourceLeakDetector; -import org.wowtools.common.utils.ResourcesReader; +import org.slf4j.LoggerFactory; +import org.wowtools.hppt.common.util.ResourcesReader; import org.wowtools.hppt.run.sc.RunSc; import org.wowtools.hppt.run.ss.RunSs; +import java.io.File; + /** * @author liuyu * @date 2024/1/5 @@ -12,15 +18,24 @@ public class Run { public static void main(String[] args) throws Exception { + System.setProperty("logFileName", args.length > 0 ? String.join("-", args).replace(".", "_") : "hppt"); + try { + LoggerContext context = (LoggerContext) LoggerFactory.getILoggerFactory(); + File externalConfigFile = new File(ResourcesReader.getRootPath(Run.class) + "/logback.xml"); + JoranConfigurator configurator = new JoranConfigurator(); + configurator.setContext(context); + context.reset(); + configurator.doConfigure(externalConfigFile); + StatusPrinter.printInCaseOfErrorsOrWarnings(context); + } catch (Exception e) { + System.out.println("未加载到根目录下logback.xml文件,使用默认配置 " + e.getMessage()); + } try { if ("1".equals(ResourcesReader.readStr(Run.class, "/debug.txt").trim())) { ResourceLeakDetector.setLevel(ResourceLeakDetector.Level.PARANOID); System.out.println("开启调试"); - } else { - System.out.println("不开启调试"); } } catch (Exception e) { - System.out.println("不开启调试"); } String type = args[0]; switch (type) { diff --git a/run/src/main/java/org/wowtools/hppt/run/sc/RunSc.java b/run/src/main/java/org/wowtools/hppt/run/sc/RunSc.java index 340ccf2..9b162e0 100644 --- a/run/src/main/java/org/wowtools/hppt/run/sc/RunSc.java +++ b/run/src/main/java/org/wowtools/hppt/run/sc/RunSc.java @@ -1,9 +1,8 @@ package org.wowtools.hppt.run.sc; import lombok.extern.slf4j.Slf4j; -import org.apache.logging.log4j.core.config.Configurator; -import org.wowtools.common.utils.ResourcesReader; import org.wowtools.hppt.common.util.Constant; +import org.wowtools.hppt.common.util.ResourcesReader; import org.wowtools.hppt.run.sc.file.FileClientSessionService; import org.wowtools.hppt.run.sc.hppt.HpptClientSessionService; import org.wowtools.hppt.run.sc.pojo.ScConfig; @@ -20,9 +19,6 @@ */ @Slf4j public class RunSc { - static { - Configurator.reconfigure(new File(ResourcesReader.getRootPath(RunSc.class) + "/log4j2.xml").toURI()); - } public static void main(String[] args) { String configPath; diff --git a/run/src/main/java/org/wowtools/hppt/run/sc/rpost/RPostClientSessionService.java b/run/src/main/java/org/wowtools/hppt/run/sc/rpost/RPostClientSessionService.java index cce4195..0b76a79 100644 --- a/run/src/main/java/org/wowtools/hppt/run/sc/rpost/RPostClientSessionService.java +++ b/run/src/main/java/org/wowtools/hppt/run/sc/rpost/RPostClientSessionService.java @@ -10,6 +10,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.wowtools.hppt.common.util.BytesUtil; +import org.wowtools.hppt.common.util.DisableTraceFilter; import org.wowtools.hppt.run.sc.common.ClientSessionService; import org.wowtools.hppt.run.sc.pojo.ScConfig; import org.wowtools.hppt.run.ss.post.ErrorServlet; @@ -147,19 +148,4 @@ private void r(HttpServletRequest req, HttpServletResponse resp) throws Exceptio } } - - //禁用TRACE、TRACK - public static final class DisableTraceFilter implements Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest httpRequest = (HttpServletRequest) request; - String m = httpRequest.getMethod(); - if ("TRACE".equalsIgnoreCase(m) || "TRACK".equalsIgnoreCase(m)) { - HttpServletResponse httpResponse = (HttpServletResponse) response; - httpResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - return; - } - chain.doFilter(request, response); - } - } } diff --git a/run/src/main/java/org/wowtools/hppt/run/ss/RunSs.java b/run/src/main/java/org/wowtools/hppt/run/ss/RunSs.java index 0a07837..3131f17 100644 --- a/run/src/main/java/org/wowtools/hppt/run/ss/RunSs.java +++ b/run/src/main/java/org/wowtools/hppt/run/ss/RunSs.java @@ -1,9 +1,8 @@ package org.wowtools.hppt.run.ss; import lombok.extern.slf4j.Slf4j; -import org.apache.logging.log4j.core.config.Configurator; -import org.wowtools.common.utils.ResourcesReader; import org.wowtools.hppt.common.util.Constant; +import org.wowtools.hppt.common.util.ResourcesReader; import org.wowtools.hppt.run.ss.common.ServerSessionService; import org.wowtools.hppt.run.ss.file.FileServerSessionService; import org.wowtools.hppt.run.ss.hppt.HpptServerSessionService; @@ -13,8 +12,6 @@ import org.wowtools.hppt.run.ss.rpost.RPostServerSessionService; import org.wowtools.hppt.run.ss.websocket.WebsocketServerSessionService; -import java.io.File; - /** * @author liuyu * @date 2024/1/24 @@ -22,12 +19,6 @@ @Slf4j public class RunSs { - - static { - Configurator.reconfigure(new File(ResourcesReader.getRootPath(RunSs.class) + "/log4j2.xml").toURI()); - } - - public static void main(String[] args) throws Exception { String configPath; if (args.length <= 1) { diff --git a/run/src/main/java/org/wowtools/hppt/run/ss/post/PostServerSessionService.java b/run/src/main/java/org/wowtools/hppt/run/ss/post/PostServerSessionService.java index 3dec930..55fc025 100644 --- a/run/src/main/java/org/wowtools/hppt/run/ss/post/PostServerSessionService.java +++ b/run/src/main/java/org/wowtools/hppt/run/ss/post/PostServerSessionService.java @@ -1,8 +1,5 @@ package org.wowtools.hppt.run.ss.post; -import jakarta.servlet.*; -import jakarta.servlet.http.HttpServletRequest; -import jakarta.servlet.http.HttpServletResponse; import lombok.extern.slf4j.Slf4j; import org.eclipse.jetty.server.Server; import org.eclipse.jetty.server.ServerConnector; @@ -10,10 +7,10 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.wowtools.common.utils.LruCache; +import org.wowtools.hppt.common.util.DisableTraceFilter; import org.wowtools.hppt.run.ss.common.ServerSessionService; import org.wowtools.hppt.run.ss.pojo.SsConfig; -import java.io.IOException; import java.util.Map; /** @@ -79,19 +76,4 @@ public void doClose() throws Exception { } - //禁用TRACE、TRACK - public static final class DisableTraceFilter implements Filter { - @Override - public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException { - HttpServletRequest httpRequest = (HttpServletRequest) request; - String m = httpRequest.getMethod(); - if ("TRACE".equalsIgnoreCase(m) || "TRACK".equalsIgnoreCase(m)) { - HttpServletResponse httpResponse = (HttpServletResponse) response; - httpResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED); - return; - } - chain.doFilter(request, response); - } - } - } diff --git a/run/src/main/java/org/wowtools/hppt/run/transmit/transport/PostServerTransport.java b/run/src/main/java/org/wowtools/hppt/run/transmit/transport/PostServerTransport.java index fee719b..0431eb1 100644 --- a/run/src/main/java/org/wowtools/hppt/run/transmit/transport/PostServerTransport.java +++ b/run/src/main/java/org/wowtools/hppt/run/transmit/transport/PostServerTransport.java @@ -10,6 +10,7 @@ import org.eclipse.jetty.servlet.ServletContextHandler; import org.eclipse.jetty.servlet.ServletHolder; import org.wowtools.hppt.common.util.BytesUtil; +import org.wowtools.hppt.common.util.DisableTraceFilter; import org.wowtools.hppt.common.util.JsonConfig; import org.wowtools.hppt.run.ss.post.PostServerSessionService; @@ -77,7 +78,7 @@ public HttpServer(int port) throws Exception { errorHandler.setServer(new Server()); context.setErrorHandler(errorHandler); - context.addFilter(PostServerSessionService.DisableTraceFilter.class, "/*", null); + context.addFilter(DisableTraceFilter.class, "/*", null); server.start(); // server.join(); diff --git a/run/src/main/resources/META-INF/native-image/jni-config.json b/run/src/main/resources/META-INF/native-image/jni-config.json new file mode 100644 index 0000000..7516acc --- /dev/null +++ b/run/src/main/resources/META-INF/native-image/jni-config.json @@ -0,0 +1,27 @@ +[ { + "name" : "java.lang.Boolean", + "methods" : [ { + "name" : "getBoolean", + "parameterTypes" : [ "java.lang.String" ] + } ], + "fields" : [ ] +}, { + "name" : "sun.management.VMManagementImpl", + "fields" : [ { + "name" : "compTimeMonitoringSupport" + }, { + "name" : "currentThreadCpuTimeSupport" + }, { + "name" : "objectMonitorUsageSupport" + }, { + "name" : "otherThreadCpuTimeSupport" + }, { + "name" : "remoteDiagnosticCommandsSupport" + }, { + "name" : "synchronizerUsageSupport" + }, { + "name" : "threadAllocatedMemorySupport" + }, { + "name" : "threadContentionMonitoringSupport" + } ] +} ] \ No newline at end of file diff --git a/run/src/main/resources/META-INF/native-image/predefined-classes-config.json b/run/src/main/resources/META-INF/native-image/predefined-classes-config.json new file mode 100644 index 0000000..d4201d9 --- /dev/null +++ b/run/src/main/resources/META-INF/native-image/predefined-classes-config.json @@ -0,0 +1,4 @@ +[ { + "type" : "agent-extracted", + "classes" : [ ] +} ] \ No newline at end of file diff --git a/run/src/main/resources/META-INF/native-image/reflect-config.json b/run/src/main/resources/META-INF/native-image/reflect-config.json new file mode 100644 index 0000000..5028623 --- /dev/null +++ b/run/src/main/resources/META-INF/native-image/reflect-config.json @@ -0,0 +1,1032 @@ +[ { + "name" : "ch.qos.logback.classic.encoder.PatternLayoutEncoder", + "queryAllPublicMethods" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.joran.SerializedModelConfigurator", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.pattern.DateConverter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.pattern.LevelConverter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.pattern.LineSeparatorConverter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.pattern.LoggerConverter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.pattern.MessageConverter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.classic.util.DefaultJoranConfigurator", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.core.ConsoleAppender", + "queryAllPublicMethods" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.core.FileAppender", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "ch.qos.logback.core.OutputStreamAppender", + "methods" : [ { + "name" : "setEncoder", + "parameterTypes" : [ "ch.qos.logback.core.encoder.Encoder" ] + } ] +}, { + "name" : "ch.qos.logback.core.encoder.Encoder", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "ch.qos.logback.core.encoder.LayoutWrappingEncoder", + "methods" : [ { + "name" : "setParent", + "parameterTypes" : [ "ch.qos.logback.core.spi.ContextAware" ] + } ] +}, { + "name" : "ch.qos.logback.core.pattern.PatternLayoutEncoderBase", + "methods" : [ { + "name" : "setPattern", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "ch.qos.logback.core.rolling.RollingFileAppender", + "queryAllPublicMethods" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + }, { + "name" : "setFile", + "parameterTypes" : [ "java.lang.String" ] + }, { + "name" : "setRollingPolicy", + "parameterTypes" : [ "ch.qos.logback.core.rolling.RollingPolicy" ] + } ] +}, { + "name" : "ch.qos.logback.core.rolling.RollingPolicy", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "ch.qos.logback.core.rolling.RollingPolicyBase", + "methods" : [ { + "name" : "setFileNamePattern", + "parameterTypes" : [ "java.lang.String" ] + }, { + "name" : "setParent", + "parameterTypes" : [ "ch.qos.logback.core.FileAppender" ] + } ] +}, { + "name" : "ch.qos.logback.core.rolling.TimeBasedRollingPolicy", + "queryAllPublicMethods" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + }, { + "name" : "setMaxHistory", + "parameterTypes" : [ "int" ] + } ] +}, { + "name" : "ch.qos.logback.core.rolling.helper.DateTokenConverter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "ch.qos.logback.core.spi.ContextAware", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "com.fasterxml.jackson.databind.ext.Java7HandlersImpl", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.fasterxml.jackson.databind.ext.Java7SupportImpl", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.google.protobuf.ExtensionRegistry", + "methods" : [ { + "name" : "getEmptyRegistry", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.AESCipher$General", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.AESKeyGenerator", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.ARCFOURCipher", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.ChaCha20Cipher$ChaCha20Poly1305", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.DESCipher", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.DESedeCipher", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.crypto.provider.GaloisCounterMode$AESGCM", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "io.netty.bootstrap.ServerBootstrap$1", + "methods" : [ ] +}, { + "name" : "io.netty.bootstrap.ServerBootstrap$ServerBootstrapAcceptor", + "methods" : [ { + "name" : "channelRead", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "exceptionCaught", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Throwable" ] + } ] +}, { + "name" : "io.netty.buffer.AbstractByteBufAllocator", + "queryAllDeclaredMethods" : true, + "methods" : [ ] +}, { + "name" : "io.netty.buffer.AbstractReferenceCountedByteBuf", + "fields" : [ { + "name" : "refCnt" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.channel.AbstractChannelHandlerContext", + "fields" : [ { + "name" : "handlerState" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.channel.ChannelInboundHandlerAdapter", + "methods" : [ { + "name" : "channelActive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelInactive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRead", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "channelReadComplete", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRegistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelUnregistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelWritabilityChanged", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "userEventTriggered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + } ] +}, { + "name" : "io.netty.channel.ChannelInitializer", + "methods" : [ { + "name" : "channelRegistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "exceptionCaught", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Throwable" ] + } ] +}, { + "name" : "io.netty.channel.ChannelOutboundBuffer", + "fields" : [ { + "name" : "totalPendingSize" + }, { + "name" : "unwritable" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.channel.DefaultChannelConfig", + "fields" : [ { + "name" : "autoRead" + }, { + "name" : "writeBufferWaterMark" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.channel.DefaultChannelPipeline", + "fields" : [ { + "name" : "estimatorHandle" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.channel.DefaultChannelPipeline$HeadContext", + "methods" : [ { + "name" : "bind", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.net.SocketAddress", "io.netty.channel.ChannelPromise" ] + }, { + "name" : "channelActive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelInactive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRead", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "channelReadComplete", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRegistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelUnregistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelWritabilityChanged", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "close", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "io.netty.channel.ChannelPromise" ] + }, { + "name" : "connect", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.net.SocketAddress", "java.net.SocketAddress", "io.netty.channel.ChannelPromise" ] + }, { + "name" : "deregister", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "io.netty.channel.ChannelPromise" ] + }, { + "name" : "disconnect", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "io.netty.channel.ChannelPromise" ] + }, { + "name" : "exceptionCaught", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Throwable" ] + }, { + "name" : "flush", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "read", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "userEventTriggered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "write", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object", "io.netty.channel.ChannelPromise" ] + } ] +}, { + "name" : "io.netty.channel.DefaultChannelPipeline$TailContext", + "methods" : [ { + "name" : "channelActive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelInactive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRead", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "channelReadComplete", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRegistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelUnregistered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelWritabilityChanged", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "exceptionCaught", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Throwable" ] + }, { + "name" : "userEventTriggered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + } ] +}, { + "name" : "io.netty.channel.socket.nio.NioServerSocketChannel", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "io.netty.handler.codec.ByteToMessageDecoder", + "methods" : [ { + "name" : "channelRead", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "channelReadComplete", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "userEventTriggered", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + } ] +}, { + "name" : "io.netty.util.DefaultAttributeMap", + "fields" : [ { + "name" : "attributes" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.Recycler$DefaultHandle", + "fields" : [ { + "name" : "state" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.ReferenceCountUtil", + "queryAllDeclaredMethods" : true, + "methods" : [ ] +}, { + "name" : "io.netty.util.ResourceLeakDetector$DefaultResourceLeak", + "fields" : [ { + "name" : "droppedRecords" + }, { + "name" : "head" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.concurrent.DefaultPromise", + "fields" : [ { + "name" : "result" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.concurrent.SingleThreadEventExecutor", + "fields" : [ { + "name" : "state" + }, { + "name" : "threadProperties" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueColdProducerFields", + "fields" : [ { + "name" : "producerLimit" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueConsumerFields", + "fields" : [ { + "name" : "consumerIndex" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.internal.shaded.org.jctools.queues.BaseMpscLinkedArrayQueueProducerFields", + "fields" : [ { + "name" : "producerIndex" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueConsumerIndexField", + "fields" : [ { + "name" : "consumerIndex" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerIndexField", + "fields" : [ { + "name" : "producerIndex" + } ], + "methods" : [ ] +}, { + "name" : "io.netty.util.internal.shaded.org.jctools.queues.MpscArrayQueueProducerLimitField", + "fields" : [ { + "name" : "producerLimit" + } ], + "methods" : [ ] +}, { + "name" : "java.io.FilePermission", + "methods" : [ ] +}, { + "name" : "java.lang.ProcessHandle", + "methods" : [ { + "name" : "current", + "parameterTypes" : [ ] + }, { + "name" : "pid", + "parameterTypes" : [ ] + } ] +}, { + "name" : "java.lang.RuntimePermission", + "methods" : [ ] +}, { + "name" : "java.lang.Thread", + "fields" : [ { + "name" : "threadLocalRandomProbe" + } ], + "methods" : [ { + "name" : "isVirtual", + "parameterTypes" : [ ] + } ] +}, { + "name" : "java.lang.Throwable", + "methods" : [ { + "name" : "addSuppressed", + "parameterTypes" : [ "java.lang.Throwable" ] + } ] +}, { + "name" : "java.lang.management.ManagementFactory", + "methods" : [ { + "name" : "getRuntimeMXBean", + "parameterTypes" : [ ] + } ] +}, { + "name" : "java.lang.management.RuntimeMXBean", + "methods" : [ { + "name" : "getInputArguments", + "parameterTypes" : [ ] + }, { + "name" : "getUptime", + "parameterTypes" : [ ] + } ] +}, { + "name" : "java.net.NetPermission", + "methods" : [ ] +}, { + "name" : "java.net.SocketPermission", + "methods" : [ ] +}, { + "name" : "java.net.URLPermission", + "methods" : [ { + "name" : "", + "parameterTypes" : [ "java.lang.String", "java.lang.String" ] + } ] +}, { + "name" : "java.nio.Bits", + "fields" : [ { + "name" : "UNALIGNED" + } ], + "methods" : [ ] +}, { + "name" : "java.nio.Buffer", + "fields" : [ { + "name" : "address" + } ], + "methods" : [ ] +}, { + "name" : "java.nio.ByteBuffer", + "methods" : [ { + "name" : "alignedSlice", + "parameterTypes" : [ "int" ] + } ] +}, { + "name" : "java.nio.DirectByteBuffer", + "methods" : [ { + "name" : "", + "parameterTypes" : [ "long", "int" ] + } ] +}, { + "name" : "java.nio.channels.spi.SelectorProvider", + "methods" : [ { + "name" : "openServerSocketChannel", + "parameterTypes" : [ "java.net.ProtocolFamily" ] + }, { + "name" : "openSocketChannel", + "parameterTypes" : [ "java.net.ProtocolFamily" ] + } ] +}, { + "name" : "java.security.AlgorithmParametersSpi", + "methods" : [ ] +}, { + "name" : "java.security.AllPermission", + "methods" : [ ] +}, { + "name" : "java.security.SecureRandomParameters", + "methods" : [ ] +}, { + "name" : "java.security.SecurityPermission", + "methods" : [ ] +}, { + "name" : "java.sql.Date", + "methods" : [ ] +}, { + "name" : "java.sql.Timestamp", + "methods" : [ ] +}, { + "name" : "java.util.PropertyPermission", + "methods" : [ ] +}, { + "name" : "java.util.concurrent.ForkJoinTask", + "fields" : [ { + "name" : "aux" + }, { + "name" : "status" + } ], + "methods" : [ ] +}, { + "name" : "java.util.concurrent.atomic.AtomicBoolean", + "fields" : [ { + "name" : "value" + } ], + "methods" : [ ] +}, { + "name" : "java.util.concurrent.atomic.AtomicReference", + "fields" : [ { + "name" : "value" + } ], + "methods" : [ ] +}, { + "name" : "java.util.concurrent.atomic.Striped64", + "fields" : [ { + "name" : "base" + }, { + "name" : "cellsBusy" + } ], + "methods" : [ ] +}, { + "name" : "javax.net.ssl.SSLParameters", + "methods" : [ { + "name" : "setApplicationProtocols", + "parameterTypes" : [ "java.lang.String[]" ] + } ] +}, { + "name" : "javax.net.ssl.SSLSocket", + "methods" : [ { + "name" : "getApplicationProtocol", + "parameterTypes" : [ ] + } ] +}, { + "name" : "javax.smartcardio.CardPermission", + "methods" : [ ] +}, { + "name" : "jdk.internal.misc.Unsafe", + "methods" : [ { + "name" : "getUnsafe", + "parameterTypes" : [ ] + } ] +}, { + "name" : "libcore.io.Memory", + "methods" : [ ] +}, { + "name" : "org.robolectric.Robolectric", + "methods" : [ ] +}, { + "name" : "org.wowtools.hppt.common.client.ClientSessionManager$1", + "methods" : [ ] +}, { + "name" : "org.wowtools.hppt.common.client.ClientSessionManager$SimpleHandler", + "methods" : [ { + "name" : "channelActive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelInactive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "exceptionCaught", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Throwable" ] + } ] +}, { + "name" : "org.wowtools.hppt.common.util.CommonConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "methods" : [ ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$FileConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$Forward", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$HpptConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$PostConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$RHpptConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$RPostConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.sc.pojo.ScConfig$WebSocketConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "sun.misc.Unsafe", + "allDeclaredFields" : true, + "methods" : [ { + "name" : "arrayBaseOffset", + "parameterTypes" : [ "java.lang.Class" ] + }, { + "name" : "arrayIndexScale", + "parameterTypes" : [ "java.lang.Class" ] + }, { + "name" : "copyMemory", + "parameterTypes" : [ "long", "long", "long" ] + }, { + "name" : "copyMemory", + "parameterTypes" : [ "java.lang.Object", "long", "java.lang.Object", "long", "long" ] + }, { + "name" : "getAndAddLong", + "parameterTypes" : [ "java.lang.Object", "long", "long" ] + }, { + "name" : "getAndSetObject", + "parameterTypes" : [ "java.lang.Object", "long", "java.lang.Object" ] + }, { + "name" : "getBoolean", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "getByte", + "parameterTypes" : [ "long" ] + }, { + "name" : "getByte", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "getDouble", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "getFloat", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "getInt", + "parameterTypes" : [ "long" ] + }, { + "name" : "getInt", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "getLong", + "parameterTypes" : [ "long" ] + }, { + "name" : "getLong", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "getObject", + "parameterTypes" : [ "java.lang.Object", "long" ] + }, { + "name" : "invokeCleaner", + "parameterTypes" : [ "java.nio.ByteBuffer" ] + }, { + "name" : "objectFieldOffset", + "parameterTypes" : [ "java.lang.reflect.Field" ] + }, { + "name" : "putBoolean", + "parameterTypes" : [ "java.lang.Object", "long", "boolean" ] + }, { + "name" : "putByte", + "parameterTypes" : [ "long", "byte" ] + }, { + "name" : "putByte", + "parameterTypes" : [ "java.lang.Object", "long", "byte" ] + }, { + "name" : "putDouble", + "parameterTypes" : [ "java.lang.Object", "long", "double" ] + }, { + "name" : "putFloat", + "parameterTypes" : [ "java.lang.Object", "long", "float" ] + }, { + "name" : "putInt", + "parameterTypes" : [ "long", "int" ] + }, { + "name" : "putInt", + "parameterTypes" : [ "java.lang.Object", "long", "int" ] + }, { + "name" : "putLong", + "parameterTypes" : [ "long", "long" ] + }, { + "name" : "putLong", + "parameterTypes" : [ "java.lang.Object", "long", "long" ] + }, { + "name" : "putObject", + "parameterTypes" : [ "java.lang.Object", "long", "java.lang.Object" ] + }, { + "name" : "storeFence", + "parameterTypes" : [ ] + } ] +}, { + "name" : "sun.misc.VM", + "methods" : [ ] +}, { + "name" : "sun.nio.ch.SelectorImpl", + "fields" : [ { + "name" : "publicSelectedKeys" + }, { + "name" : "selectedKeys" + } ], + "methods" : [ ] +}, { + "name" : "sun.security.provider.DRBG", + "methods" : [ { + "name" : "", + "parameterTypes" : [ "java.security.SecureRandomParameters" ] + } ] +}, { + "name" : "sun.security.provider.SHA", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "sun.security.provider.SHA2$SHA256", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "sun.security.provider.SecureRandom", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + }, { + "name" : "", + "parameterTypes" : [ "java.security.SecureRandomParameters" ] + } ] +}, { + "name" : "sun.security.ssl.SSLContextImpl$TLSContext", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "io.netty.channel.socket.nio.NioSocketChannel", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "java.lang.Boolean", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.Byte", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.Double", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.Float", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.Integer", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.Long", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.Short", + "methods" : [ { + "name" : "valueOf", + "parameterTypes" : [ "java.lang.String" ] + } ] +}, { + "name" : "java.lang.System", + "methods" : [ { + "name" : "getSecurityManager", + "parameterTypes" : [ ] + } ] +}, { + "name" : "java.security.AccessController", + "methods" : [ { + "name" : "doPrivileged", + "parameterTypes" : [ "java.security.PrivilegedAction" ] + } ] +}, { + "name" : "java.util.concurrent.Executors", + "methods" : [ { + "name" : "newVirtualThreadPerTaskExecutor", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.eclipse.jetty.util.TypeUtil", + "methods" : [ { + "name" : "getClassLoaderLocation", + "parameterTypes" : [ "java.lang.Class" ] + }, { + "name" : "getCodeSourceLocation", + "parameterTypes" : [ "java.lang.Class" ] + }, { + "name" : "getModuleLocation", + "parameterTypes" : [ "java.lang.Class" ] + }, { + "name" : "getSystemClassLoaderLocation", + "parameterTypes" : [ "java.lang.Class" ] + } ] +}, { + "name" : "org.wowtools.hppt.common.server.ServerSessionManager$1", + "methods" : [ ] +}, { + "name" : "org.wowtools.hppt.common.server.ServerSessionManager$SimpleHandler", + "methods" : [ { + "name" : "channelActive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelInactive", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "channelRead", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Object" ] + }, { + "name" : "channelReadComplete", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext" ] + }, { + "name" : "exceptionCaught", + "parameterTypes" : [ "io.netty.channel.ChannelHandlerContext", "java.lang.Throwable" ] + } ] +}, { + "name" : "org.wowtools.hppt.common.util.DisableTraceFilter", + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$Client", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$FileConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$HpptConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$PostConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$RHpptConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$RPostConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +}, { + "name" : "org.wowtools.hppt.run.ss.pojo.SsConfig$WebSocketConfig", + "allDeclaredFields" : true, + "queryAllDeclaredMethods" : true, + "queryAllDeclaredConstructors" : true, + "methods" : [ { + "name" : "", + "parameterTypes" : [ ] + } ] +} ] diff --git a/run/src/main/resources/META-INF/native-image/resource-config.json b/run/src/main/resources/META-INF/native-image/resource-config.json new file mode 100644 index 0000000..6fb0179 --- /dev/null +++ b/run/src/main/resources/META-INF/native-image/resource-config.json @@ -0,0 +1,44 @@ +{ + "resources" : { + "bundles" : [ ], + "includes" : [ { + "pattern" : "\\QMETA-INF/services/ch.qos.logback.classic.spi.Configurator\\E" + }, { + "pattern" : "\\QMETA-INF/services/java.lang.System$LoggerFinder\\E" + }, { + "pattern" : "\\QMETA-INF/services/java.net.spi.InetAddressResolverProvider\\E" + }, { + "pattern" : "\\QMETA-INF/services/java.net.spi.URLStreamHandlerProvider\\E" + }, { + "pattern" : "\\QMETA-INF/services/java.nio.channels.spi.SelectorProvider\\E" + }, { + "pattern" : "\\QMETA-INF/services/java.time.zone.ZoneRulesProvider\\E" + }, { + "pattern" : "\\QMETA-INF/services/javax.xml.parsers.SAXParserFactory\\E" + }, { + "pattern" : "\\QMETA-INF/services/org.slf4j.spi.SLF4JServiceProvider\\E" + }, { + "pattern" : "\\Qlogback-test.scmo\\E" + }, { + "pattern" : "\\Qlogback-test.xml\\E" + }, { + "pattern" : "\\Qlogback.scmo\\E" + }, { + "pattern" : "\\Qlogback.xml\\E" + }, { + "pattern" : "java.base:\\Qjdk/internal/icu/impl/data/icudt72b/uprops.icu\\E" + }, { + "pattern" : "java.base:\\Qsun/net/idn/uidna.spp\\E" + }, { + "pattern" : "\\QMETA-INF/services/java.util.spi.ResourceBundleControlProvider\\E" + }, { + "pattern" : "\\QMETA-INF/services/org.eclipse.jetty.http.HttpFieldPreEncoder\\E" + }, { + "pattern" : "\\Qorg/eclipse/jetty/http/encoding.properties\\E" + }, { + "pattern" : "\\Qorg/eclipse/jetty/http/mime.properties\\E" + }, { + "pattern" : "\\Qorg/eclipse/jetty/version/build.properties\\E" + } ] + } +} \ No newline at end of file diff --git a/run/src/main/resources/META-INF/native-image/serialization-config.json b/run/src/main/resources/META-INF/native-image/serialization-config.json new file mode 100644 index 0000000..68eba83 --- /dev/null +++ b/run/src/main/resources/META-INF/native-image/serialization-config.json @@ -0,0 +1,5 @@ +{ + "lambdaCapturingTypes" : [ ], + "proxies" : [ ], + "types" : [ ] +} \ No newline at end of file diff --git a/run/src/main/resources/log4j2.xml b/run/src/main/resources/log4j2.xml deleted file mode 100644 index a4664de..0000000 --- a/run/src/main/resources/log4j2.xml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - %d{MM-dd HH:mm:ss} [%t] %-5level %logger{36} - %msg%n - - - - - - - - - - - - - - - - - - diff --git a/run/src/main/resources/logback.xml b/run/src/main/resources/logback.xml new file mode 100644 index 0000000..3b2f1ab --- /dev/null +++ b/run/src/main/resources/logback.xml @@ -0,0 +1,37 @@ + + + + + + + + + + logs/${LOG_FILE_NAME}.log + + + logs/${LOG_FILE_NAME}.%d{yyyy-MM-dd}.log + + 30 + + + ${LOG_PATTERN} + + + + + + + ${LOG_PATTERN} + + + + + + + + + + + + diff --git a/common/src/test/java/nettytest/NettyClient.java b/run/src/test/java/nettytest/NettyClient.java similarity index 100% rename from common/src/test/java/nettytest/NettyClient.java rename to run/src/test/java/nettytest/NettyClient.java diff --git a/common/src/test/java/nettytest/NettyServer.java b/run/src/test/java/nettytest/NettyServer.java similarity index 100% rename from common/src/test/java/nettytest/NettyServer.java rename to run/src/test/java/nettytest/NettyServer.java diff --git a/common/src/test/java/org/wowtools/hppt/common/client/ClientSessionManagerTest.java b/run/src/test/java/org/wowtools/hppt/common/client/ClientSessionManagerTest.java similarity index 100% rename from common/src/test/java/org/wowtools/hppt/common/client/ClientSessionManagerTest.java rename to run/src/test/java/org/wowtools/hppt/common/client/ClientSessionManagerTest.java diff --git a/common/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java b/run/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java similarity index 95% rename from common/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java rename to run/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java index b21194f..81fc712 100644 --- a/common/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java +++ b/run/src/test/java/org/wowtools/hppt/common/server/ServerSessionManagerTest.java @@ -1,4 +1,4 @@ -//package org.wowtools.hppt.common.server; +package org.wowtools.hppt.common.server;//package org.wowtools.hppt.common.server; // // //import java.nio.charset.StandardCharsets; diff --git a/common/src/test/java/org/wowtools/hppt/common/util/AesCipherUtilTest.java b/run/src/test/java/org/wowtools/hppt/common/util/AesCipherUtilTest.java similarity index 100% rename from common/src/test/java/org/wowtools/hppt/common/util/AesCipherUtilTest.java rename to run/src/test/java/org/wowtools/hppt/common/util/AesCipherUtilTest.java diff --git a/common/src/test/java/org/wowtools/hppt/common/util/BytesUtilTest.java b/run/src/test/java/org/wowtools/hppt/common/util/BytesUtilTest.java similarity index 100% rename from common/src/test/java/org/wowtools/hppt/common/util/BytesUtilTest.java rename to run/src/test/java/org/wowtools/hppt/common/util/BytesUtilTest.java diff --git a/common/src/test/java/org/wowtools/hppt/common/util/GridAesCipherUtilTest.java b/run/src/test/java/org/wowtools/hppt/common/util/GridAesCipherUtilTest.java similarity index 100% rename from common/src/test/java/org/wowtools/hppt/common/util/GridAesCipherUtilTest.java rename to run/src/test/java/org/wowtools/hppt/common/util/GridAesCipherUtilTest.java diff --git a/run/src/test/java/org/wowtools/hppt/run/ss/post/CombinedServer.java b/run/src/test/java/org/wowtools/hppt/run/ss/post/CombinedServer.java new file mode 100644 index 0000000..720ff9f --- /dev/null +++ b/run/src/test/java/org/wowtools/hppt/run/ss/post/CombinedServer.java @@ -0,0 +1,173 @@ +package org.wowtools.hppt.run.ss.post; + +import io.netty.bootstrap.ServerBootstrap; +import io.netty.buffer.ByteBuf; +import io.netty.buffer.Unpooled; +import io.netty.channel.*; +import io.netty.channel.nio.NioEventLoopGroup; +import io.netty.channel.socket.SocketChannel; +import io.netty.channel.socket.nio.NioServerSocketChannel; +import io.netty.handler.codec.http.*; +import io.netty.handler.logging.LogLevel; +import io.netty.handler.logging.LoggingHandler; +import lombok.extern.slf4j.Slf4j; +import org.wowtools.hppt.common.util.BytesUtil; + +import java.util.LinkedList; +import java.util.List; +import java.util.concurrent.TimeUnit; + +@Slf4j +public final class CombinedServer { + + private final PostServerSessionService postServerSessionService; + private final long waitResponseTime; + private final long replyDelayTime; + + public CombinedServer(PostServerSessionService postServerSessionService, long waitResponseTime, long replyDelayTime) { + this.postServerSessionService = postServerSessionService; + this.waitResponseTime = waitResponseTime; + this.replyDelayTime = replyDelayTime; + } + + public void start(int port) throws InterruptedException { + EventLoopGroup bossGroup = new NioEventLoopGroup(1); + EventLoopGroup workerGroup = new NioEventLoopGroup(); + + try { + ServerBootstrap b = new ServerBootstrap(); + b.group(bossGroup, workerGroup) + .channel(NioServerSocketChannel.class) + .handler(new LoggingHandler(LogLevel.INFO)) + .childHandler(new ChannelInitializer() { + @Override + public void initChannel(SocketChannel ch) { + ChannelPipeline p = ch.pipeline(); + p.addLast(new HttpServerCodec()); + p.addLast(new HttpObjectAggregator(65536)); + p.addLast(new CombinedServerHandler(postServerSessionService, waitResponseTime, replyDelayTime)); + } + }); + + Channel ch = b.bind(port).sync().channel(); + + log.info("Netty combined server started on port {}", port); + + ch.closeFuture().sync(); + } finally { + bossGroup.shutdownGracefully(); + workerGroup.shutdownGracefully(); + } + } + + public static void main(String[] args) throws InterruptedException { + PostServerSessionService postServerSessionService = null; + long waitResponseTime = 5000L; // example value + long replyDelayTime = 100L; // example value + new CombinedServer(postServerSessionService, waitResponseTime, replyDelayTime).start(8888); + } + + @Slf4j + private static class CombinedServerHandler extends SimpleChannelInboundHandler { + + private final PostServerSessionService postServerSessionService; + private final long waitResponseTime; + private final long replyDelayTime; + + public CombinedServerHandler(PostServerSessionService postServerSessionService, long waitResponseTime, long replyDelayTime) { + this.postServerSessionService = postServerSessionService; + this.waitResponseTime = waitResponseTime; + this.replyDelayTime = replyDelayTime; + } + + @Override + protected void channelRead0(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { + String uri = req.uri(); + if (uri.startsWith("/s")) { + handleSend(ctx, req); + } else if (uri.startsWith("/r")) { + handleReply(ctx, req); + } else { + sendResponse(ctx, req, HttpResponseStatus.NOT_FOUND); + } + } + + private void handleSend(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { + if (req.method() == HttpMethod.POST) { + String cookie = req.uri().substring(req.uri().indexOf("c=") + 2); + PostCtx postCtx = postServerSessionService.ctxMap.computeIfAbsent(cookie, PostCtx::new); + receive(postCtx, req); + sendResponse(ctx, req, HttpResponseStatus.OK); + } else { + sendResponse(ctx, req, HttpResponseStatus.METHOD_NOT_ALLOWED); + } + } + + private void handleReply(ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { + if (req.method() == HttpMethod.POST) { + String cookie = req.uri().substring(req.uri().indexOf("c=") + 2); + PostCtx postCtx = postServerSessionService.ctxMap.get(cookie); + if (postCtx != null) { + write(postCtx, ctx, req); + } else { + sendResponse(ctx, req, HttpResponseStatus.NO_CONTENT); + } + } else { + sendResponse(ctx, req, HttpResponseStatus.METHOD_NOT_ALLOWED); + } + } + + private void receive(PostCtx postCtx, FullHttpRequest req) { + ByteBuf content = req.content(); + byte[] bytes = new byte[content.readableBytes()]; + content.readBytes(bytes); + + log.debug("Received request body {}", bytes.length); + + List bytesList = BytesUtil.pbBytes2BytesList(bytes); + for (byte[] sub : bytesList) { + postServerSessionService.receiveClientBytes(postCtx, sub); + } + } + + private void write(PostCtx postCtx, ChannelHandlerContext ctx, FullHttpRequest req) throws Exception { + if (replyDelayTime > 0) { + Thread.sleep(replyDelayTime); + } + + List bytesList = new LinkedList<>(); + byte[] rBytes = postCtx.sendQueue.poll(waitResponseTime, TimeUnit.MILLISECONDS); + if (rBytes == null) { + sendResponse(ctx, req, HttpResponseStatus.NO_CONTENT); + return; + } + bytesList.add(rBytes); + + postCtx.sendQueue.drainTo(bytesList); + rBytes = BytesUtil.bytesCollection2PbBytes(bytesList); + log.debug("Sending bytes to client bytesList {} body {}", bytesList.size(), rBytes.length); + + FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK, Unpooled.wrappedBuffer(rBytes)); + response.headers().set(HttpHeaderNames.CONTENT_TYPE, "application/octet-stream"); + response.headers().set(HttpHeaderNames.CONTENT_LENGTH, rBytes.length); + ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); + } + + private void sendResponse(ChannelHandlerContext ctx, FullHttpRequest req, HttpResponseStatus status) { + FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, status); + response.headers().set(HttpHeaderNames.CONTENT_TYPE, "text/plain; charset=UTF-8"); + response.headers().set(HttpHeaderNames.CONTENT_LENGTH, 0); + if (HttpUtil.isKeepAlive(req)) { + response.headers().set(HttpHeaderNames.CONNECTION, HttpHeaderValues.KEEP_ALIVE); + } + + ctx.writeAndFlush(response).addListener(ChannelFutureListener.CLOSE); + } + + @Override + public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) { + log.error("Error handling request", cause); + ctx.close(); + } + } +} diff --git a/common/src/test/java/t1/BytesCallBack.java b/run/src/test/java/t1/BytesCallBack.java similarity index 100% rename from common/src/test/java/t1/BytesCallBack.java rename to run/src/test/java/t1/BytesCallBack.java diff --git a/common/src/test/java/t1/ClientPort.java b/run/src/test/java/t1/ClientPort.java similarity index 100% rename from common/src/test/java/t1/ClientPort.java rename to run/src/test/java/t1/ClientPort.java diff --git a/common/src/test/java/t1/ClientSession.java b/run/src/test/java/t1/ClientSession.java similarity index 100% rename from common/src/test/java/t1/ClientSession.java rename to run/src/test/java/t1/ClientSession.java diff --git a/common/src/test/java/t1/ClientSessionManager.java b/run/src/test/java/t1/ClientSessionManager.java similarity index 100% rename from common/src/test/java/t1/ClientSessionManager.java rename to run/src/test/java/t1/ClientSessionManager.java diff --git a/common/src/test/java/t1/ServerPort.java b/run/src/test/java/t1/ServerPort.java similarity index 100% rename from common/src/test/java/t1/ServerPort.java rename to run/src/test/java/t1/ServerPort.java diff --git a/common/src/test/java/t1/ServerSession.java b/run/src/test/java/t1/ServerSession.java similarity index 100% rename from common/src/test/java/t1/ServerSession.java rename to run/src/test/java/t1/ServerSession.java diff --git a/common/src/test/java/t1/ServerSessionManager.java b/run/src/test/java/t1/ServerSessionManager.java similarity index 100% rename from common/src/test/java/t1/ServerSessionManager.java rename to run/src/test/java/t1/ServerSessionManager.java diff --git a/common/src/test/java/t1/SessionBytes.java b/run/src/test/java/t1/SessionBytes.java similarity index 100% rename from common/src/test/java/t1/SessionBytes.java rename to run/src/test/java/t1/SessionBytes.java diff --git a/common/src/test/java/t1/Test.java b/run/src/test/java/t1/Test.java similarity index 100% rename from common/src/test/java/t1/Test.java rename to run/src/test/java/t1/Test.java diff --git a/common/src/test/java/test/ByteArrayCompressionExample.java b/run/src/test/java/test/ByteArrayCompressionExample.java similarity index 100% rename from common/src/test/java/test/ByteArrayCompressionExample.java rename to run/src/test/java/test/ByteArrayCompressionExample.java diff --git a/common/src/test/java/test/LZ4CompressionExample.java b/run/src/test/java/test/LZ4CompressionExample.java similarity index 100% rename from common/src/test/java/test/LZ4CompressionExample.java rename to run/src/test/java/test/LZ4CompressionExample.java diff --git a/common/src/test/java/test/ReadYmlConfig.java b/run/src/test/java/test/ReadYmlConfig.java similarity index 95% rename from common/src/test/java/test/ReadYmlConfig.java rename to run/src/test/java/test/ReadYmlConfig.java index eae46d5..9d2c65f 100644 --- a/common/src/test/java/test/ReadYmlConfig.java +++ b/run/src/test/java/test/ReadYmlConfig.java @@ -2,7 +2,7 @@ import com.fasterxml.jackson.databind.ObjectMapper; import com.fasterxml.jackson.dataformat.yaml.YAMLFactory; -import org.wowtools.common.utils.ResourcesReader; +import org.wowtools.hppt.common.util.ResourcesReader; /** * @author liuyu diff --git a/common/src/test/java/test/SimpleNettyClient.java b/run/src/test/java/test/SimpleNettyClient.java similarity index 100% rename from common/src/test/java/test/SimpleNettyClient.java rename to run/src/test/java/test/SimpleNettyClient.java diff --git a/common/src/test/java/test/SimpleNettyServer.java b/run/src/test/java/test/SimpleNettyServer.java similarity index 100% rename from common/src/test/java/test/SimpleNettyServer.java rename to run/src/test/java/test/SimpleNettyServer.java diff --git a/common/src/test/java/test/SymmetricEncryptionExample.java b/run/src/test/java/test/SymmetricEncryptionExample.java similarity index 100% rename from common/src/test/java/test/SymmetricEncryptionExample.java rename to run/src/test/java/test/SymmetricEncryptionExample.java diff --git a/common/src/test/java/test/TCPForwardingServer.java b/run/src/test/java/test/TCPForwardingServer.java similarity index 100% rename from common/src/test/java/test/TCPForwardingServer.java rename to run/src/test/java/test/TCPForwardingServer.java