Search in sources :

Example 6 with FactoryCreator

use of org.webpieces.nio.api.libs.FactoryCreator in project webpieces by deanhiller.

the class TestUdpIntegration method setUpImpl.

/*
     * @see TestCase#setUp()
     */
protected void setUpImpl() throws Exception {
    if (bufFactory == null) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(FactoryCreator.KEY_IS_DIRECT, false);
        FactoryCreator creator = FactoryCreator.createFactory(null);
        bufFactory = creator.createBufferFactory(map);
    }
    ChannelServiceFactory basic = ChannelServiceFactory.createFactory(null);
    Map<String, Object> props2 = new HashMap<String, Object>();
    props2.put(ChannelServiceFactory.KEY_IMPLEMENTATION_CLASS, ChannelServiceFactory.VAL_EXCEPTION_CHANNEL_MGR);
    props2.put(ChannelServiceFactory.KEY_CHILD_CHANNELMGR_FACTORY, basic);
    ChannelServiceFactory factory = ChannelServiceFactory.createFactory(props2);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put(ChannelManagerOld.KEY_BUFFER_FACTORY, bufFactory);
    map.put(ChannelManagerOld.KEY_ID, "server+client");
    svc = factory.createChannelManager(map);
    svc.start();
    client = svc.createUDPChannel("client", null);
    server = svc.createUDPChannel("server", null);
    clientHandler = createMock(DataListener.class);
    svrHandler = createMock(DataListener.class);
    clientHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
    svrHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
}
Also used : HashMap(java.util.HashMap) CloneByteBuffer(org.webpieces.nio.api.testutil.CloneByteBuffer) FactoryCreator(org.webpieces.nio.api.libs.FactoryCreator) ChannelServiceFactory(org.webpieces.nio.api.deprecated.ChannelServiceFactory) MockObject(biz.xsoftware.mock.MockObject) DataListener(org.webpieces.nio.api.handlers.DataListener)

Example 7 with FactoryCreator

use of org.webpieces.nio.api.libs.FactoryCreator in project webpieces by deanhiller.

the class TestDatagramChannel method setUpImpl.

/*
     * @see TestCase#setUp()
     */
protected void setUpImpl() throws Exception {
    if (bufFactory == null) {
        Map<String, Object> map = new HashMap<String, Object>();
        map.put(FactoryCreator.KEY_IS_DIRECT, false);
        FactoryCreator creator = FactoryCreator.createFactory(null);
        bufFactory = creator.createBufferFactory(map);
    }
    ChannelServiceFactory basic = ChannelServiceFactory.createFactory(null);
    Map<String, Object> props2 = new HashMap<String, Object>();
    props2.put(ChannelServiceFactory.KEY_IMPLEMENTATION_CLASS, ChannelServiceFactory.VAL_EXCEPTION_CHANNEL_MGR);
    props2.put(ChannelServiceFactory.KEY_CHILD_CHANNELMGR_FACTORY, basic);
    ChannelServiceFactory factory = ChannelServiceFactory.createFactory(props2);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put(ChannelManagerOld.KEY_BUFFER_FACTORY, bufFactory);
    map.put(ChannelManagerOld.KEY_ID, "server+client");
    svc = factory.createChannelManager(map);
    svc.start();
    client = svc.createDatagramChannel("client", 100);
    client2 = svc.createDatagramChannel("client2", 100);
    server = svc.createDatagramChannel("server", 100);
    clientHandler = createMock(DatagramListener.class);
    svrHandler = createMock(DatagramListener.class);
    clientHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
    svrHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
}
Also used : DatagramListener(org.webpieces.nio.api.handlers.DatagramListener) HashMap(java.util.HashMap) CloneByteBuffer(org.webpieces.nio.api.testutil.CloneByteBuffer) FactoryCreator(org.webpieces.nio.api.libs.FactoryCreator) ChannelServiceFactory(org.webpieces.nio.api.deprecated.ChannelServiceFactory) MockObject(biz.xsoftware.mock.MockObject)

Aggregations

FactoryCreator (org.webpieces.nio.api.libs.FactoryCreator)7 CloneByteBuffer (org.webpieces.nio.api.testutil.CloneByteBuffer)6 MockObject (biz.xsoftware.mock.MockObject)4 HashMap (java.util.HashMap)4 ChannelServiceFactory (org.webpieces.nio.api.deprecated.ChannelServiceFactory)3 DataListener (org.webpieces.nio.api.handlers.DataListener)3 SSLEngine (javax.net.ssl.SSLEngine)2 AsyncSSLEngine (org.webpieces.nio.api.libs.AsyncSSLEngine)2 SSLEngineFactory (org.webpieces.nio.api.libs.SSLEngineFactory)2 MockSSLEngineFactory (org.webpieces.nio.api.testutil.MockSSLEngineFactory)2 CalledMethod (biz.xsoftware.mock.CalledMethod)1 InetSocketAddress (java.net.InetSocketAddress)1 ChannelService (org.webpieces.nio.api.deprecated.ChannelService)1 ConnectionCallback (org.webpieces.nio.api.deprecated.ConnectionCallback)1 Settings (org.webpieces.nio.api.deprecated.Settings)1 DatagramListener (org.webpieces.nio.api.handlers.DatagramListener)1 OperationCallback (org.webpieces.nio.api.handlers.OperationCallback)1 PacketListener (org.webpieces.nio.api.libs.PacketListener)1 PacketProcessorFactory (org.webpieces.nio.api.libs.PacketProcessorFactory)1 SocketChannel (org.webpieces.nio.api.testutil.chanapi.SocketChannel)1