Search in sources :

Example 11 with StringEncoder

use of org.jboss.netty.handler.codec.string.StringEncoder in project traccar by tananaev.

the class H02Protocol method initTrackerServers.

@Override
public void initTrackerServers(List<TrackerServer> serverList) {
    serverList.add(new TrackerServer(new ServerBootstrap(), getName()) {

        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            int messageLength = Context.getConfig().getInteger(getName() + ".messageLength");
            pipeline.addLast("frameDecoder", new H02FrameDecoder(messageLength));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectEncoder", new H02ProtocolEncoder());
            pipeline.addLast("objectDecoder", new H02ProtocolDecoder(H02Protocol.this));
        }
    });
    serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {

        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectEncoder", new H02ProtocolEncoder());
            pipeline.addLast("objectDecoder", new H02ProtocolDecoder(H02Protocol.this));
        }
    });
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) TrackerServer(org.traccar.TrackerServer) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) ConnectionlessBootstrap(org.jboss.netty.bootstrap.ConnectionlessBootstrap)

Example 12 with StringEncoder

use of org.jboss.netty.handler.codec.string.StringEncoder in project traccar by tananaev.

the class Pt502Protocol 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 Pt502FrameDecoder());
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectEncoder", new Pt502ProtocolEncoder());
            pipeline.addLast("objectDecoder", new Pt502ProtocolDecoder(Pt502Protocol.this));
        }
    };
    server.setEndianness(ByteOrder.LITTLE_ENDIAN);
    serverList.add(server);
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) StringDecoder(org.jboss.netty.handler.codec.string.StringDecoder) TrackerServer(org.traccar.TrackerServer) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline)

Example 13 with StringEncoder

use of org.jboss.netty.handler.codec.string.StringEncoder in project traccar by tananaev.

the class XirgoProtocol 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, "##"));
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("stringDecoder", new StringDecoder());
            pipeline.addLast("objectEncoder", new XirgoProtocolEncoder());
            pipeline.addLast("objectDecoder", new XirgoProtocolDecoder(XirgoProtocol.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("objectEncoder", new XirgoProtocolEncoder());
            pipeline.addLast("objectDecoder", new XirgoProtocolDecoder(XirgoProtocol.this));
        }
    });
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) CharacterDelimiterFrameDecoder(org.traccar.CharacterDelimiterFrameDecoder) StringDecoder(org.jboss.netty.handler.codec.string.StringDecoder) TrackerServer(org.traccar.TrackerServer) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) ConnectionlessBootstrap(org.jboss.netty.bootstrap.ConnectionlessBootstrap)

Example 14 with StringEncoder

use of org.jboss.netty.handler.codec.string.StringEncoder in project traccar by tananaev.

the class WondexProtocol 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 WondexFrameDecoder());
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectEncoder", new WondexProtocolEncoder());
            pipeline.addLast("objectDecoder", new WondexProtocolDecoder(WondexProtocol.this));
        }
    });
    serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {

        @Override
        protected void addSpecificHandlers(ChannelPipeline pipeline) {
            pipeline.addLast("stringEncoder", new StringEncoder());
            pipeline.addLast("objectEncoder", new WondexProtocolEncoder());
            pipeline.addLast("objectDecoder", new WondexProtocolDecoder(WondexProtocol.this));
        }
    });
}
Also used : StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) TrackerServer(org.traccar.TrackerServer) ServerBootstrap(org.jboss.netty.bootstrap.ServerBootstrap) ChannelPipeline(org.jboss.netty.channel.ChannelPipeline) ConnectionlessBootstrap(org.jboss.netty.bootstrap.ConnectionlessBootstrap)

Example 15 with StringEncoder

use of org.jboss.netty.handler.codec.string.StringEncoder in project camel by apache.

the class NettyHttpGetWithInvalidMessageTest method createRegistry.

@Override
protected JndiRegistry createRegistry() throws Exception {
    JndiRegistry registry = super.createRegistry();
    // setup the String encoder and decoder 
    StringDecoder stringDecoder = new StringDecoder();
    registry.bind("string-decoder", stringDecoder);
    StringEncoder stringEncoder = new StringEncoder();
    registry.bind("string-encoder", stringEncoder);
    List<ChannelHandler> decoders = new ArrayList<ChannelHandler>();
    decoders.add(stringDecoder);
    List<ChannelHandler> encoders = new ArrayList<ChannelHandler>();
    encoders.add(stringEncoder);
    registry.bind("encoders", encoders);
    registry.bind("decoders", decoders);
    return registry;
}
Also used : JndiRegistry(org.apache.camel.impl.JndiRegistry) StringEncoder(org.jboss.netty.handler.codec.string.StringEncoder) ArrayList(java.util.ArrayList) StringDecoder(org.jboss.netty.handler.codec.string.StringDecoder) ChannelHandler(org.jboss.netty.channel.ChannelHandler)

Aggregations

StringEncoder (org.jboss.netty.handler.codec.string.StringEncoder)24 ChannelPipeline (org.jboss.netty.channel.ChannelPipeline)18 StringDecoder (org.jboss.netty.handler.codec.string.StringDecoder)17 ServerBootstrap (org.jboss.netty.bootstrap.ServerBootstrap)16 TrackerServer (org.traccar.TrackerServer)15 ConnectionlessBootstrap (org.jboss.netty.bootstrap.ConnectionlessBootstrap)12 CharacterDelimiterFrameDecoder (org.traccar.CharacterDelimiterFrameDecoder)5 JndiRegistry (org.apache.camel.impl.JndiRegistry)3 InetSocketAddress (java.net.InetSocketAddress)2 ArrayList (java.util.ArrayList)2 ExecutionHandler (org.freeswitch.esl.client.internal.debug.ExecutionHandler)2 EslFrameDecoder (org.freeswitch.esl.client.transport.message.EslFrameDecoder)2 ChannelHandler (org.jboss.netty.channel.ChannelHandler)2 DelimiterBasedFrameDecoder (org.jboss.netty.handler.codec.frame.DelimiterBasedFrameDecoder)2 LineBasedFrameDecoder (org.jboss.netty.handler.codec.frame.LineBasedFrameDecoder)2 OrderedMemoryAwareThreadPoolExecutor (org.jboss.netty.handler.execution.OrderedMemoryAwareThreadPoolExecutor)2 LineOrientedRequestEncoder (org.opennms.netmgt.provision.detector.simple.support.LineOrientedRequestEncoder)2 ClientBootstrap (org.jboss.netty.bootstrap.ClientBootstrap)1 ChannelFuture (org.jboss.netty.channel.ChannelFuture)1 ChannelPipelineFactory (org.jboss.netty.channel.ChannelPipelineFactory)1