意外的消息类型:HttpClientCodec管道上的DefaultHttpRequest [英] unexpected message type: DefaultHttpRequest, on a HttpClientCodec pipeline

查看:142
本文介绍了意外的消息类型:HttpClientCodec管道上的DefaultHttpRequest的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

频道上的第二个.write导致异常

A second .write on the channel, results in an exception

"io.netty.handler.codec.CodecException:java.lang.IllegalStateException:意外消息类型:DefaultHttpRequest".

"io.netty.handler.codec.CodecException: java.lang.IllegalStateException: unexpected message type: DefaultHttpRequest".

抓挠我的脑袋应该做些不同的事情,因为管道上只有HttpClientCodec.通过从 Github 克隆并运行main(运行客户端和服务器端)来重现错误. /p>

Scratching my head what should be done differently, given that the pipeline only has HttpClientCodec on it. Reproduces by cloning from Github and running main, which runs the client and server sides, reproducing the error.

推荐答案

您必须编写DefaultFullHttpResponse. DefaultHttpResponse缺少内容,并且HttpContentLastHttpContent必须紧随其后.我同意这确实令人困惑.

You have to write a DefaultFullHttpResponse. DefaultHttpResponse lacks content and HttpContents and a LastHttpContent must follow. I agree this is confusing indeed.

这篇关于意外的消息类型:HttpClientCodec管道上的DefaultHttpRequest的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆