yy1717
2024-02-28 27fc91fbe8f88b6885356e68828cfe1ce1db7601
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package com.anyun.exam.lib.net
 
import android.util.Log
import io.netty.channel.ChannelPromise
import io.netty.channel.ChannelDuplexHandler
import io.netty.channel.ChannelFutureListener
import io.netty.channel.ChannelHandlerContext
 
 
class ExceptionHandler : ChannelDuplexHandler() {
    override fun exceptionCaught(ctx: ChannelHandlerContext, cause: Throwable) {
        // Uncaught exceptions from inbound handlers will propagate up to this handler
        Log.e(Constant.LOGTAG,cause.localizedMessage)
    }
//    @Throws(Exception::class)
//    override fun write(ctx: ChannelHandlerContext, msg: Any, promise: ChannelPromise) {
//        ctx.write(msg, promise.addListener { future ->
//            if (!future.isSuccess) {
//                logger.error("send data to client exception occur: ", future.cause())
//            }
//        })
//    }
 
}