in tchannel-core/src/main/java/com/uber/tchannel/api/TChannel.java [451:493]
protected void initChannel(@NotNull SocketChannel ch) throws Exception {
// Translates TCP Streams to Raw Frames
ch.pipeline().addLast("FrameDecoder", new TChannelLengthFieldBasedFrameDecoder());
// Translates Raw Frames into TFrames
// ch.pipeline().addLast("TFrameCodec", new TFrameCodec());
// Translates TFrames into Messages
// ch.pipeline().addLast("MessageCodec", new MessageCodec());
if (isServer) {
ch.pipeline().addLast("InitRequestHandler",
new InitRequestHandler(topChannel.getPeerManager()));
} else {
ch.pipeline().addLast("InitRequestInitiator",
new InitRequestInitiator(topChannel.getPeerManager()));
}
// Ping frame is not current used
// Handle PingRequestFrame
// ch.pipeline().addLast("PingHandler", new PingHandler());
// Handles Call Request RPC
ch.pipeline().addLast("MessageDefragmenter", new MessageDefragmenter());
ch.pipeline().addLast("MessageFragmenter", new MessageFragmenter());
if (isServer && loadControlHandlerFactory != null) {
ch.pipeline().addLast("LoadControl", loadControlHandlerFactory.create());
}
// Pass RequestHandlers to the RequestRouter
ch.pipeline().addLast(
"RequestRouter",
topChannel.getCustomRequestRouter() != null
? topChannel.getCustomRequestRouter()
: new RequestRouter(topChannel, getExecutorService())
);
ch.pipeline().addLast("ResponseRouter", new ResponseRouter(topChannel, timer));
// Register Channels as they are created.
ch.pipeline().addLast("ChannelRegistrar", new ChannelRegistrar(topChannel.getPeerManager()));
}