not an SSL/TLS record 解码输出

在Netty中,如果开启了https,但是你使用http请求来发送请求,那么会打印一个SSL/TLS异常,如下:

2018-08-13 02:24:36.782 WARN  [vert.x-eventloop-thread-2] i.n.c.DefaultChannelPipeline[151]: An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
io.netty.handler.codec.DecoderException: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 474554202f637365656e67696e652f76312f656e67696e65733f706167652d6e6f3d3126706167652d73697a653d333020485454502f312e310d0a486f73743a203139322e3134352e3130342e39363a33303131370d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a557365722d4167656e743a204d6f7a696c6c612f352e30202857696e646f7773204e5420362e313b20574f57363429204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f36382e302e333434302e3735205361666172692f3533372e33360d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a782d617574682d746f6b656e3a204d4949533267594a4b6f5a496876634e415163436f494953797a434345736343415145784454414c42676c67686b67425a514d45416745776768456f42676b71686b694739773042427747676768455a4249495246587369644739725a5734694f6e73695a58687761584a6c6331396864434936496a49774d5467744d4467744d5452554d4445364e4467364d4441754d7a597a4d44417757694973496d316c644768765a484d694f6c73696347467a63336476636d51695853776959324630595778765a79493657313073496e4a766247567a496a706265794a755957316c496a6f696447566659575274615734694c434a705a434936496a45354f544a6a4d57526d4f57466b4e6a51784d6d5535597a677a4d7a417a4d6d4e6b4e7a426a5954686d496e307365794a755957316c496a6f69623342665a3246305a5752665a576c7758326c77646a59694c434a705a434936496a416966537837496d3568625755694f694a766346396e5958526c5a46396861584e665a47566d623263694c434a705a434936496a416966537837496d3568625755694f694a766346396e5958526c5a46396b6146397459794973496d6c6b496a6f694d434a394c487369626d46745a534936496d3977583264686447566b583246706331397a6458426c636c39795a584e76624856306157397549697769615751694f694977496e307365794a755957316c496a6f69623342665a3246305a575266593239735a434973496d6c6b496a6f694d434a394c487369626d46745a534936496d3977583264686447566b58334a6b633139746557397764434973496d6c6b496a6f694d434a394c487369626d46745a534936496d3977583264686447566b583246706331397659334a66596d46756131396a59584a6b49697769615751694f694977496e307365794a755957316c496a6f69623342665a3246305a57526659324a7a58334668596d393049697769615751694f694977496e307365794a755957316c496a6f69623342665a3246305a575266626d5633
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:459)
        at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:265)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:340)
        at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1434)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:362)
        at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:348)
        at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:965)
        at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163)
        at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
        at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
        at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:884)
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
        at java.lang.Thread.run(Thread.java:748)
Caused by: io.netty.handler.ssl.NotSslRecordException: not an SSL/TLS record: 474554202f637365656e67696e652f76312f656e67696e65733f706167652d6e6f3d3126706167652d73697a653d333020485454502f312e310d0a486f73743a203139322e3134352e3130342e39363a33303131370d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a557365722d4167656e743a204d6f7a696c6c612f352e30202857696e646f7773204e5420362e313b20574f57363429204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f36382e302e333434302e3735205361666172692f3533372e33360d0a43616368652d436f6e74726f6c3a206e6f2d63616368650d0a782d617574682d746f6b656e3a204d4949533267594a4b6f5a496876634e415163436f494953797a434345736343415145784454414c42676c67686b67425a514d45416745776768456f42676b71686b694739773042427747676768455a4249495246587369644739725a5734694f6e73695a58687761584a6c6331396864434936496a49774d5467744d4467744d5452554d4445364e4467364d4441754d7a597a4d44417757694973496d316c644768765a484d694f6c73696347467a63336476636d51695853776959324630595778765a79493657313073496e4a766247567a496a706265794a755957316c496a6f696447566659575274615734694c434a705a434936496a45354f544a6a4d57526d4f57466b4e6a51784d6d5535597a677a4d7a417a4d6d4e6b4e7a426a5954686d496e307365794a755957316c496a6f69623342665a3246305a5752665a576c7758326c77646a59694c434a705a434936496a416966537837496d3568625755694f694a766346396e5958526c5a46396861584e665a47566d623263694c434a705a434936496a416966537837496d3568625755694f694a766346396e5958526c5a46396b6146397459794973496d6c6b496a6f694d434a394c487369626d46745a534936496d3977583264686447566b583246706331397a6458426c636c39795a584e76624856306157397549697769615751694f694977496e307365794a755957316c496a6f69623342665a3246305a575266593239735a434973496d6c6b496a6f694d434a394c487369626d46745a534936496d3977583264686447566b58334a6b633139746557397764434973496d6c6b496a6f694d434a394c487369626d46745a534936496d3977583264686447566b583246706331397659334a66596d46756131396a59584a6b49697769615751694f694977496e307365794a755957316c496a6f69623342665a3246305a57526659324a7a58334668596d393049697769615751694f694977496e307365794a755957316c496a6f69623342665a3246305a575266626d5633
        at io.netty.handler.ssl.SslHandler.decodeJdkCompatible(SslHandler.java:1156)
        at io.netty.handler.ssl.SslHandler.decode(SslHandler.java:1221)
        at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:489)
        at io.netty.handler.codec.ByteToMessageDecoder.callDecode(ByteToMessageDecoder.java:428)
        ... 16 common frames omitted

我们可以把这个16进制编码流解码出来看下内容是什么:

        String code = "474554202f637365656e67696e652f76312f656e67696e65733f706167652d6e6f3d3126706167652d73697a653d333020485454502f312e310d0a486f73743a203139322e3134352e3130342e39363a33303131370d0a436f6e6e656374696f6e3a206b6565702d616c6976650d0a43616368652d436f6e74726f6c3a206d61782d6167653d300d0a557067726164652d496e7365637572652d52657175657374733a20310d0a557365722d4167656e743a204d6f7a696c6c612f352e30202857696e646f7773204e5420362e313b20574f57363429204170706c655765624b69742f3533372e333620284b48544d4c2c206c696b65204765636b6f29204368726f6d652f36382e302e333434302e3735205361666172692f3533372e33360d0a4163636570743a20746578742f68746d6c2c6170706c69636174696f6e2f7868746d6c2b786d6c2c6170706c69636174696f6e2f786d6c3b713d302e392c696d6167652f776562702c696d6167652f61706e672c2a2f2a3b713d302e380d0a4163636570742d456e636f64696e673a20677a69702c206465666c6174650d0a4163636570742d4c616e67756167653a207a682d434e2c7a683b713d302e392c656e3b713d302e380d0a0d0a";
        byte[] bytes = ByteBufUtil.decodeHexDump(code);
        System.out.println(new String(bytes));

解出来内容如下:

GET /cseengine/v1/engines?page-no=1&page-size=30 HTTP/1.1
Host: 192.145.104.96:30117
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.75 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en;q=0.8
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 201,552评论 5 474
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 84,666评论 2 377
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 148,519评论 0 334
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 54,180评论 1 272
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 63,205评论 5 363
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 48,344评论 1 281
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 37,781评论 3 393
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,449评论 0 256
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 40,635评论 1 295
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,467评论 2 317
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 37,515评论 1 329
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,217评论 3 318
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 38,775评论 3 303
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 29,851评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,084评论 1 258
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 42,637评论 2 348
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,204评论 2 341

推荐阅读更多精彩内容