arex-agent-java icon indicating copy to clipboard operation
arex-agent-java copied to clipboard

Netty4 server无法记录或者回放

Open jinwik opened this issue 3 months ago • 0 comments

Steps to reproduce deps: vertx-web 3.9.4

public class ServerVerticle extends AbstractVerticle {
    @Override
    public void start() {
        Router router = Router.router(vertx);
        router.get("/hello").handler(routingContext -> {
            routingContext.response().end(new JsonObject().put("message", "Hello, World!").encode());
        });
        vertx.createHttpServer()
            .requestHandler(router)
            .listen(9998);
    }

    public static void main(String[] args) {
        Vertx.vertx().deployVerticle(ServerVerticle.class.getName());
    }
}

Environment

Compiler: 1.8 arex-agent-java: 0.4.0

Additional context 简单修复: 删除掉RequestTracingHandler:channelReadComplete 在ResponseTracingHandler#invoke方法中 添加 if (ContextManager.needReplay()) { MockUtils.replayBody(mocker); } else if (ContextManager.needRecord()) { MockUtils.recordMocker(mocker); } CaseEventDispatcher.onEvent(CaseEvent.ofExitEvent());

jinwik avatar Mar 20 '24 06:03 jinwik