use of com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory in project baseio by generallycloud.
the class TestTeller method main.
public static void main(String[] args) throws Exception {
SimpleIoEventHandle eventHandle = new SimpleIoEventHandle();
SocketChannelContext context = new NioSocketChannelContext(new ServerConfiguration(8300));
SocketChannelConnector connector = new SocketChannelConnector(context);
context.setIoEventHandleAdaptor(eventHandle);
context.setProtocolFactory(new ParamedProtobaseProtocolFactory());
context.addSessionEventListener(new LoggerSocketSEListener());
FixedSession session = new FixedSession(connector.connect());
boolean b = session.login("admin", "admin100");
System.out.println(b);
MessageProducer producer = new DefaultMessageProducer(session);
TextMessage message = new TextMessage("msgId", "uuid", "你好!");
MapMessage mapMessage = new MapMessage("msgId", "uuid");
mapMessage.put("test", "test111111111111111111111");
long old = System.currentTimeMillis();
producer.offer(message);
producer.offer(mapMessage);
System.out.println("Time:" + (System.currentTimeMillis() - old));
connector.close();
}
Aggregations