老师的源代码启动之后一旦刷新网页,或者关闭网页,就会抛异常,请问如何解决它?
源代码虽然可以正常使用,发消息也没问题。但是启动网页后,一刷新网页或者关闭网页,就会抛异常:
*******************************************************************************************************************
目前我们不支持二进制消息
java.lang.RuntimeException: 【com.imooc.netty.websocket.MyWebSocketHandler】不支持消息
客户端与服务端连接关闭...
at com.imooc.netty.websocket.MyWebSocketHandler.handWebsocketFrame(MyWebSocketHandler.java:104)
at com.imooc.netty.websocket.MyWebSocketHandler.messageReceived(MyWebSocketHandler.java:80)
at io.netty.channel.SimpleChannelInboundHandler.channelRead(SimpleChannelInboundHandler.java:103)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:74)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:138)
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:154)
at io.netty.channel.ChannelHandlerInvokerUtil.invokeChannelReadNow(ChannelHandlerInvokerUtil.java:74)
at io.netty.channel.DefaultChannelHandlerInvoker.invokeChannelRead(DefaultChannelHandlerInvoker.java:138)
at io.netty.channel.DefaultChannelHandlerContext.fireChannelRead(DefaultChannelHandlerContext.java:320)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:846)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:127)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:485)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:452)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:346)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:794)
at java.lang.Thread.run(Thread.java:745)
客户端与服务端连接开启...
****************************************************************************************************************************
请问一下异常的原因,以及如何解决异常。