All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.neko233.virtualRouter.server.pipeline.RouterServerChannelInitializer.kt Maven / Gradle / Ivy

package com.neko233.virtualRouter.server.pipeline

import com.neko233.virtualRouter.core.codec.JsonDecoderByRouter
import com.neko233.virtualRouter.core.codec.MessageDecoder
import com.neko233.virtualRouter.core.codec.RouterClientMessageEncoder
import com.neko233.virtualRouter.server.handler.JsonObjDispatcherHandler
import io.netty.channel.Channel
import io.netty.channel.ChannelInitializer

class RouterServerChannelInitializer : ChannelInitializer() {
    override fun initChannel(ch: Channel?) {
        ch ?: return
        val pipeline = ch.pipeline()
        pipeline
            // req
            .addLast("bytes-splitter-decoder", MessageDecoder())
            .addLast("json-decoder", JsonDecoderByRouter())
            .addLast("req-obj-handler", JsonObjDispatcherHandler())
            // resp
            .addLast("bytes-splitter-encoder", RouterClientMessageEncoder())
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy