Search in sources :

Example 6 with ParamedProtobaseProtocolFactory

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();
}
Also used : SocketChannelConnector(com.generallycloud.baseio.connector.SocketChannelConnector) DefaultMessageProducer(com.generallycloud.baseio.container.jms.client.impl.DefaultMessageProducer) LoggerSocketSEListener(com.generallycloud.baseio.component.LoggerSocketSEListener) ServerConfiguration(com.generallycloud.baseio.configuration.ServerConfiguration) MapMessage(com.generallycloud.baseio.container.jms.MapMessage) FixedSession(com.generallycloud.baseio.container.FixedSession) SimpleIoEventHandle(com.generallycloud.baseio.container.SimpleIoEventHandle) SocketChannelContext(com.generallycloud.baseio.component.SocketChannelContext) NioSocketChannelContext(com.generallycloud.baseio.component.NioSocketChannelContext) NioSocketChannelContext(com.generallycloud.baseio.component.NioSocketChannelContext) DefaultMessageProducer(com.generallycloud.baseio.container.jms.client.impl.DefaultMessageProducer) MessageProducer(com.generallycloud.baseio.container.jms.client.MessageProducer) ParamedProtobaseProtocolFactory(com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory) TextMessage(com.generallycloud.baseio.container.jms.TextMessage)

Aggregations

ParamedProtobaseProtocolFactory (com.generallycloud.baseio.codec.protobase.ParamedProtobaseProtocolFactory)6 LoggerSocketSEListener (com.generallycloud.baseio.component.LoggerSocketSEListener)6 SocketChannelContext (com.generallycloud.baseio.component.SocketChannelContext)6 NioSocketChannelContext (com.generallycloud.baseio.component.NioSocketChannelContext)5 ServerConfiguration (com.generallycloud.baseio.configuration.ServerConfiguration)5 SocketChannelConnector (com.generallycloud.baseio.connector.SocketChannelConnector)5 FixedSession (com.generallycloud.baseio.container.FixedSession)5 SimpleIoEventHandle (com.generallycloud.baseio.container.SimpleIoEventHandle)5 Message (com.generallycloud.baseio.container.jms.Message)2 TextMessage (com.generallycloud.baseio.container.jms.TextMessage)2 MessageProducer (com.generallycloud.baseio.container.jms.client.MessageProducer)2 DefaultMessageProducer (com.generallycloud.baseio.container.jms.client.impl.DefaultMessageProducer)2 ParamedProtobaseBeatFutureFactory (com.generallycloud.baseio.codec.protobase.future.ParamedProtobaseBeatFutureFactory)1 ProtobaseFuture (com.generallycloud.baseio.codec.protobase.future.ProtobaseFuture)1 ProtobaseFutureImpl (com.generallycloud.baseio.codec.protobase.future.ProtobaseFutureImpl)1 BlackIPFilter (com.generallycloud.baseio.container.BlackIPFilter)1 MapMessage (com.generallycloud.baseio.container.jms.MapMessage)1 MessageBrowser (com.generallycloud.baseio.container.jms.client.MessageBrowser)1 MessageConsumer (com.generallycloud.baseio.container.jms.client.MessageConsumer)1 OnMessage (com.generallycloud.baseio.container.jms.client.OnMessage)1