Skip to content

Instantly share code, notes, and snippets.

@zeroFruit
Created July 23, 2022 00:26
Show Gist options
  • Save zeroFruit/11c80e1ef75e1d60f62a95964890ca5c to your computer and use it in GitHub Desktop.
Save zeroFruit/11c80e1ef75e1d60f62a95964890ca5c to your computer and use it in GitHub Desktop.
Channel concept & implementation— el Project (2)
public class DefaultChannelPipeline implements ChannelPipeline {
@Override
public ChannelPromise bind(SocketAddress localAddress) {
return this.tailContext.bind(localAddress);
}
@Override
public ChannelPromise bind(SocketAddress localAddress, ChannelPromise promise) {
return this.tailContext.bind(localAddress, promise);
}
@Override
public ChannelPromise connect(SocketAddress remoteAddress, ChannelPromise promise) {
return this.tailContext.connect(remoteAddress, promise);
}
private static final class TailContext extends AbstractChannelHandlerContext {
private final TailContextHandler handler;
public TailContext(ChannelPipeline pipeline) {
super(HEAD_NAME, pipeline, null, TailContextHandler.class);
this.handler = new TailContextHandler();
}
@Override
public ChannelHandler handler() {
return this.handler;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment