springboot-netty
springboot-netty copied to clipboard
这个报错怎么处理啊??
public class ClientHandlerInitializer extends ChannelInitializer<Channel> {
@Override
protected void initChannel(Channel ch) throws Exception {
ch.pipeline()
.addLast(new IdleStateHandler(0, 10, 0))
.addLast(new ProtobufVarint32FrameDecoder())
.addLast(new ProtobufDecoder(MessageBase.Message.getDefaultInstance()))
.addLast(new ProtobufVarint32LengthFieldPrepender())
.addLast(new ProtobufEncoder())
.addLast(new HeartbeatHandler())
.addLast(new NettyClientHandler());
}
}
addLast(new HeartbeatHandler(new NettyClient())),创建一个客户端进行连接就行,你可以尝试下