Showing
1 changed file
with
38 additions
and
0 deletions
1 | +package org.onlab.onos.foo; | ||
2 | + | ||
3 | +import java.io.IOException; | ||
4 | + | ||
5 | +import org.jboss.netty.handler.logging.LoggingHandler; | ||
6 | +import org.onlab.netty.EchoHandler; | ||
7 | +import org.onlab.netty.KryoSerializer; | ||
8 | +import org.onlab.netty.NettyMessagingService; | ||
9 | +import org.slf4j.Logger; | ||
10 | +import org.slf4j.LoggerFactory; | ||
11 | + | ||
12 | +/** | ||
13 | + * Test to measure Messaging performance. | ||
14 | + */ | ||
15 | + public class SimpleNettyServer { | ||
16 | + private static Logger log = LoggerFactory.getLogger(IOLoopTestServer.class); | ||
17 | + | ||
18 | + private SimpleNettyServer() {} | ||
19 | + | ||
20 | + public static void main(String... args) throws Exception { | ||
21 | + startStandalone(args); | ||
22 | + System.exit(0); | ||
23 | + } | ||
24 | + | ||
25 | + public static void startStandalone(String[] args) throws IOException { | ||
26 | + NettyMessagingService server = new NettyMessagingService(8080); | ||
27 | + try { | ||
28 | + server.activate(); | ||
29 | + } catch (Exception e) { | ||
30 | + e.printStackTrace(); | ||
31 | + } | ||
32 | + server.setSerializer(new KryoSerializer()); | ||
33 | + server.registerHandler("simple", | ||
34 | + (org.onlab.netty.MessageHandler) new LoggingHandler()); | ||
35 | + server.registerHandler("echo", new EchoHandler()); | ||
36 | + } | ||
37 | + } | ||
38 | + |
-
Please register or login to post a comment