ChannelFactory comFactory = new NioServerSocketChannelFactory(Executors.newCachedThreadPool(),
Executors.newCachedThreadPool(), (Runtime.getRuntime().availableProcessors() * 2 + 1) * 2);
ServerBootstrap comBootstrap = new ServerBootstrap(comFactory);
ChannelGroup comGroup = new DefaultChannelGroup("compacter");
final CompacterHandler comHandler = new CompacterHandler(comGroup, state);
comBootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
pipeline.addLast("decoder", new ObjectDecoder());