use of org.webpieces.nio.api.testutil.CloneByteBuffer in project webpieces by deanhiller.
the class ZNioSuperclassTest method setUp.
protected void setUp() throws Exception {
HandlerForTests.setupLogging();
//and started back up cleanly.....
if (chanMgr == null) {
chanMgr = getClientChanMgr();
}
if (mockServer == null) {
ChannelService svcChanMgr = getServerChanMgr();
mockServer = new MockNIOServer(svcChanMgr, getServerFactoryHolder());
}
chanMgr.start();
svrAddr = mockServer.start();
log.trace("server port =" + svrAddr);
loopBack = InetAddress.getByName("127.0.0.1");
loopBackAnyPort = new InetSocketAddress(loopBack, 0);
mockHandler = MockObjectFactory.createMock(DataListener.class);
mockHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
mockConnect = MockObjectFactory.createMock(ConnectionCallback.class);
client1 = chanMgr.createTCPChannel("ClientChannel", getClientFactoryHolder());
}
use of org.webpieces.nio.api.testutil.CloneByteBuffer in project webpieces by deanhiller.
the class TestBasicUDP method setUp.
protected void setUp() throws Exception {
HandlerForTests.setupLogging();
//and started back up cleanly.....
if (chanMgr == null) {
chanMgr = ChannelServiceFactory.createDefaultChannelMgr("client");
}
if (mockServer == null) {
ChannelService svcChanMgr = getServerChanMgr();
mockServer = new MockNIOServer(svcChanMgr, getServerFactoryHolder());
}
chanMgr.start();
svrAddr = mockServer.start();
log.info("server port =" + svrAddr);
loopBack = InetAddress.getByName("127.0.0.1");
remoteAddr = new InetSocketAddress(loopBack, svrAddr.getPort() + 1);
mockHandler = MockObjectFactory.createMock(DataListener.class);
mockHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
client1 = chanMgr.createUDPChannel("ClientChannel", getClientFactoryHolder());
}
use of org.webpieces.nio.api.testutil.CloneByteBuffer 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());
}
Aggregations