我正在尝试关闭来自 netty reactor.ipc.netty.tcp.TcpClient 的 TCP 连接,但我找不到轻松的方法,没有“断开连接”、“停止”或“关闭”方法。谁能帮我?我正在使用 reactor-netty.0.7.9.RELEASE 库。
我的班级结构如下:
private TcpClient client;
private NettyOutbound out;
public Mono<? extends NettyContext> connect() {
client = TcpClient.create(host, port);
return client.newHandler(this::handleConnection)
.log("newHandler");
}
private Publisher<Void> handleConnection(NettyInbound in, NettyOutbound out) {
this.out = out;
return out
.neverComplete() //keep connection alive
.log("Never close");
}
public void disconnect() {
client = TcpClient. //What can i put here to close the connection?
}
感谢您的帮助,非常感谢您提前。