use of org.jboss.netty.bootstrap.ConnectionlessBootstrap in project traccar by traccar.
the class TeltonikaProtocol 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 TeltonikaFrameDecoder());
pipeline.addLast("objectEncoder", new TeltonikaProtocolEncoder());
pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(TeltonikaProtocol.this, false));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("objectEncoder", new TeltonikaProtocolEncoder());
pipeline.addLast("objectDecoder", new TeltonikaProtocolDecoder(TeltonikaProtocol.this, true));
}
});
}
use of org.jboss.netty.bootstrap.ConnectionlessBootstrap in project traccar by traccar.
the class TaipProtocol 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("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new TaipProtocolDecoder(TaipProtocol.this));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectDecoder", new TaipProtocolDecoder(TaipProtocol.this));
}
});
}
use of org.jboss.netty.bootstrap.ConnectionlessBootstrap in project traccar by traccar.
the class VtfmsProtocol 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 VtfmsFrameDecoder());
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectDecoder", new VtfmsProtocolDecoder(VtfmsProtocol.this));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("objectDecoder", new VtfmsProtocolDecoder(VtfmsProtocol.this));
}
});
}
use of org.jboss.netty.bootstrap.ConnectionlessBootstrap in project traccar by traccar.
the class Tk103Protocol 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 Tk103FrameDecoder());
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new Tk103ProtocolEncoder());
pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(Tk103Protocol.this));
}
});
serverList.add(new TrackerServer(new ConnectionlessBootstrap(), getName()) {
@Override
protected void addSpecificHandlers(ChannelPipeline pipeline) {
pipeline.addLast("stringDecoder", new StringDecoder());
pipeline.addLast("stringEncoder", new StringEncoder());
pipeline.addLast("objectEncoder", new Tk103ProtocolEncoder());
pipeline.addLast("objectDecoder", new Tk103ProtocolDecoder(Tk103Protocol.this));
}
});
}
use of org.jboss.netty.bootstrap.ConnectionlessBootstrap in project pinpoint by naver.
the class NettyUdpReceiverTest method server.
/*
* netty io thread is single-threaded even for udp.
* this is for running multiple workers.
* */
@Test
public void server() throws IOException, InterruptedException {
final ConnectionlessBootstrap udpServer = createUdpServer();
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
udpServer.bind(new InetSocketAddress("127.0.0.1", PORT));
try {
logger.debug("server-await");
latch.await();
} catch (InterruptedException ignored) {
}
logger.debug("server-shutdown");
udpServer.shutdown();
}
});
thread.start();
Thread.sleep(1000);
logger.debug("start--------");
// ExecutorService executorService = Executors.newFixedThreadPool(10);
// for (int i =0; i< 10; i++) {
// executorService.execute(new Runnable() {
// @Override
// public void run() {
// try {
start();
// } catch (IOException e) {
// e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates.
// }
// }
// });
// }
// executorService.awaitTermination(120, TimeUnit.SECONDS) ;
latch.countDown();
}
Aggregations