Search in sources :

Example 1 with ChannelService

use of org.webpieces.nio.api.deprecated.ChannelService in project webpieces by deanhiller.

the class TestXEvaluateNIOBehavior method setUp.

public void setUp() {
    String os = System.getProperty("os.name");
    //String osArch = System.getProperty("os.arch");
    log.info("os=" + os);
    if (os.equals("linux")) {
        log.info("RUNNING LINUX TESTS ONLY");
        isLinux = true;
    }
    try {
        if (mockServer == null) {
            ChannelServiceFactory factory = ChannelServiceFactory.createFactory(null);
            Map<String, Object> p = new HashMap<String, Object>();
            p.put(ChannelManagerOld.KEY_ID, "[server]");
            p.put(ChannelManagerOld.KEY_BUFFER_FACTORY, bufFactory);
            ChannelService chanMgr = factory.createChannelManager(p);
            mockServer = new MockNIOServer(chanMgr, null);
        }
        svrAddr = mockServer.start();
        log.info("svrPort=" + svrAddr);
    } catch (IOException e) {
        throw new RuntimeException("test failed", e);
    } catch (InterruptedException e) {
        throw new RuntimeException("test failed2", e);
    }
}
Also used : HashMap(java.util.HashMap) ChannelService(org.webpieces.nio.api.deprecated.ChannelService) ChannelServiceFactory(org.webpieces.nio.api.deprecated.ChannelServiceFactory) MockNIOServer(org.webpieces.nio.api.testutil.MockNIOServer) IOException(java.io.IOException)

Example 2 with ChannelService

use of org.webpieces.nio.api.deprecated.ChannelService in project webpieces by deanhiller.

the class TestAsynchWrites 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(DataHandler.class);
//		mockHandler.setCloner(new CloneByteBuffer());
//		mockConnect = MockObjectFactory.createMock(ConnectCallback.class);
//		client1 = chanMgr.createTCPChannel("ClientChannel", getClientFactoryHolder());		
}
Also used : ChannelService(org.webpieces.nio.api.deprecated.ChannelService) MockNIOServer(org.webpieces.nio.api.testutil.MockNIOServer)

Example 3 with ChannelService

use of org.webpieces.nio.api.deprecated.ChannelService in project webpieces by deanhiller.

the class XTestDelayServer method setUp.

protected void setUp() throws Exception {
    FactoryCreator creator = FactoryCreator.createFactory(null);
    procFactory = creator.createPacketProcFactory(null);
    factoryHolder = new Settings(null, procFactory);
    HandlerForTests.setupLogging();
    LoggerFactory.getLogger("").setLevel(Level.INFO);
    //and started back up cleanly.....		
    if (chanMgr == null) {
        chanMgr = createClientChanMgr("[client]");
    }
    if (echoServer == null) {
        ChannelService svrChanMgr = createSvrChanMgr("[echoServer]");
        echoServer = new EchoServer(svrChanMgr, factoryHolder);
    }
    if (delayServer == null) {
        delayServer = new DelayServer();
    }
    chanMgr.start();
    InetSocketAddress echoSvrAddr = echoServer.start();
    log.trace("echo server port =" + echoSvrAddr);
    delaySvrAddr = delayServer.start(echoSvrAddr);
    log.trace("delay server port =" + delaySvrAddr);
    mockHandler = MockObjectFactory.createMock(DataListener.class);
    mockHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
    mockConnect = MockObjectFactory.createMock(ConnectionCallback.class);
}
Also used : ChannelService(org.webpieces.nio.api.deprecated.ChannelService) InetSocketAddress(java.net.InetSocketAddress) CloneByteBuffer(org.webpieces.nio.api.testutil.CloneByteBuffer) FactoryCreator(org.webpieces.nio.api.libs.FactoryCreator) DataListener(org.webpieces.nio.api.handlers.DataListener) ConnectionCallback(org.webpieces.nio.api.deprecated.ConnectionCallback) Settings(org.webpieces.nio.api.deprecated.Settings)

Example 4 with ChannelService

use of org.webpieces.nio.api.deprecated.ChannelService in project webpieces by deanhiller.

the class TestMoreSecureChanMgr method getServerChanMgr.

protected ChannelService getServerChanMgr() {
    Map<String, Object> p = new HashMap<String, Object>();
    p.put(ChannelManagerOld.KEY_ID, "server");
    p.put(ChannelManagerOld.KEY_BUFFER_FACTORY, bufFactory);
    ChannelService svcChanMgr = basicFactory.createChannelManager(p);
    return svcChanMgr;
}
Also used : HashMap(java.util.HashMap) ChannelService(org.webpieces.nio.api.deprecated.ChannelService) MockObject(biz.xsoftware.mock.MockObject)

Example 5 with ChannelService

use of org.webpieces.nio.api.deprecated.ChannelService in project webpieces by deanhiller.

the class TestZNioSecureCM method getServerChanMgr.

@Override
protected ChannelService getServerChanMgr() {
    Map<String, Object> p = new HashMap<String, Object>();
    p.put(ChannelManagerOld.KEY_ID, "server");
    p.put(ChannelManagerOld.KEY_BUFFER_FACTORY, getBufFactory());
    ChannelService svcChanMgr = secureFactory.createChannelManager(p);
    return svcChanMgr;
}
Also used : HashMap(java.util.HashMap) ChannelService(org.webpieces.nio.api.deprecated.ChannelService)

Aggregations

ChannelService (org.webpieces.nio.api.deprecated.ChannelService)16 InetSocketAddress (java.net.InetSocketAddress)7 HashMap (java.util.HashMap)7 CloneByteBuffer (org.webpieces.nio.api.testutil.CloneByteBuffer)6 MockNIOServer (org.webpieces.nio.api.testutil.MockNIOServer)6 DataListener (org.webpieces.nio.api.handlers.DataListener)5 ConnectionCallback (org.webpieces.nio.api.deprecated.ConnectionCallback)4 Settings (org.webpieces.nio.api.deprecated.Settings)4 SSLEngineFactory (org.webpieces.nio.api.libs.SSLEngineFactory)3 MockSSLEngineFactory (org.webpieces.nio.api.testutil.MockSSLEngineFactory)3 MockObject (biz.xsoftware.mock.MockObject)2 InetAddress (java.net.InetAddress)2 ChannelServiceFactory (org.webpieces.nio.api.deprecated.ChannelServiceFactory)2 IOException (java.io.IOException)1 SSLEngine (javax.net.ssl.SSLEngine)1 TCPChannel (org.webpieces.nio.api.channels.TCPChannel)1 TCPServerChannel (org.webpieces.nio.api.channels.TCPServerChannel)1 OperationCallback (org.webpieces.nio.api.handlers.OperationCallback)1 AsyncSSLEngine (org.webpieces.nio.api.libs.AsyncSSLEngine)1 FactoryCreator (org.webpieces.nio.api.libs.FactoryCreator)1