use of org.jboss.netty.handler.codec.string.StringEncoder in project bigbluebutton by bigbluebutton.
the class AbstractOutboundPipelineFactory method getPipeline.
public ChannelPipeline getPipeline() throws Exception {
ChannelPipeline pipeline = Channels.pipeline();
// Add the text line codec combination first
pipeline.addLast("encoder", new StringEncoder());
// Note that outbound mode requires the decoder to treat many 'headers' as body lines
pipeline.addLast("decoder", new EslFrameDecoder(8092, true));
// Add an executor to ensure separate thread for each upstream message from here
pipeline.addLast("executor", new ExecutionHandler(new OrderedMemoryAwareThreadPoolExecutor(16, 1048576, 1048576)));
// now the outbound client logic
pipeline.addLast("clientHandler", makeHandler());
return pipeline;
}
use of org.jboss.netty.handler.codec.string.StringEncoder in project opennms by OpenNMS.
the class AsyncLineOrientedDetectorNettyImpl method appendToPipeline.
@Override
protected void appendToPipeline(ChannelPipeline retval) {
// Upstream handlers
retval.addLast("frameDecoder", new DelimiterBasedFrameDecoder(1024, Delimiters.lineDelimiter()));
retval.addLast("stringDecoder", new StringDecoder(CharsetUtil.UTF_8));
retval.addLast("lineDecoder", new LineOrientedResponseDecoder());
// Downstream handlers
retval.addLast("stringEncoder", new StringEncoder(CharsetUtil.UTF_8));
retval.addLast("lineEncoder", new LineOrientedRequestEncoder());
}
use of org.jboss.netty.handler.codec.string.StringEncoder in project yyl_example by Relucent.
the class NettyServer method main.
public static void main(String[] args) {
ServerBootstrap bootstrap = new //
ServerBootstrap(new //
NioServerSocketChannelFactory(// boss
Executors.newCachedThreadPool(), // worker
Executors.newCachedThreadPool()));
// Set up the default event pipeline.
bootstrap.setPipelineFactory(new ChannelPipelineFactory() {
@Override
public ChannelPipeline getPipeline() throws Exception {
return Channels.pipeline(new StringDecoder(), new StringEncoder(), new ServerHandler());
}
});
// Bind and start to accept incoming connections.
Channel bind = bootstrap.bind(new InetSocketAddress(8000));
System.out.println("Server started, listening port: " + bind.getLocalAddress() + ", Waiting for client register...");
}
use of org.jboss.netty.handler.codec.string.StringEncoder in project traccar by tananaev.
the class MeitrackProtocol method initTrackerServers.
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
TrackerServer server = new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new MeitrackFrameDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
server = new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new MeitrackProtocolEncoder());
pipeline.addLast("objectDecoder", new MeitrackProtocolDecoder(MeitrackProtocol.this));
}
};
server.setEndianness(ByteOrder.LITTLE_ENDIAN);
serverList.add(server);
}
use of org.jboss.netty.handler.codec.string.StringEncoder in project traccar by tananaev.
the class Gl100Protocol method initTrackerServers.
@Override
public void initTrackerServers(List<TrackerServer> serverList) {
serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("frameDecoder", new CharacterDelimiterFrameDecoder(1024, '\0'));
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(Gl100Protocol.this));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectDecoder", new Gl100ProtocolDecoder(Gl100Protocol.this));
}
});
}
Aggregations