【发布时间】:2015-05-15 00:24:00
【问题描述】:
我想使用 Netty 4 编写一个 HTTP 客户端,它不需要创建任何额外的线程。
我从 HttpSnoopClient 开始工作并尝试替换:
EventLoopGroup group = new NioEventLoopGroup();
与:
EventLoopGroup group = new NioEventLoopGroup(1, new Executor() {
public void execute(Runnable command) {
command.run();
}
});
但是程序挂了:
ChannelFuture f = bootstrap.connect(host, port);
Netty in Action 一书没有提到这种可能性,但我有一些希望(在这里和那里设置适当的回调或侦听器......)。现在我想知道这是否可能。
提前感谢您的任何提示。
【问题讨论】:
标签: netty