Skip to content

Instantly share code, notes, and snippets.

@nickman
Created June 12, 2012 13:51
Show Gist options
  • Select an option

  • Save nickman/2917629 to your computer and use it in GitHub Desktop.

Select an option

Save nickman/2917629 to your computer and use it in GitHub Desktop.
MyStringServerFactory - Shared
public class MyStringServerFactory implements ChannelPipelineFactory {
private final StringEncoder stringEncoder = new StringEncoder(CharsetUtil.UTF_8);
private final StringDecoder stringDecoder = new StringDecoder(CharsetUtil.UTF_8);
public ChannelPipeline getPipeline() throws Exception { ChannelPipeline p = Channels.pipeline();
// Decoders
p.addLast("frameDecoder", new DelimiterBasedFrameDecoder(Delimiters.lineDelimiter()));
p.ddLast("stringDecoder", stringDecoder);
// Encoder
p.addLast("stringEncoder", stringEncoder);
return p;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment