Search in sources :

Example 6 with MockNIOServer

use of org.webpieces.nio.api.testutil.MockNIOServer 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());
}
Also used : ChannelService(org.webpieces.nio.api.deprecated.ChannelService) InetSocketAddress(java.net.InetSocketAddress) CloneByteBuffer(org.webpieces.nio.api.testutil.CloneByteBuffer) DataListener(org.webpieces.nio.api.handlers.DataListener) MockNIOServer(org.webpieces.nio.api.testutil.MockNIOServer)

Aggregations

ChannelService (org.webpieces.nio.api.deprecated.ChannelService)6 MockNIOServer (org.webpieces.nio.api.testutil.MockNIOServer)6 InetSocketAddress (java.net.InetSocketAddress)4 CloneByteBuffer (org.webpieces.nio.api.testutil.CloneByteBuffer)4 DataListener (org.webpieces.nio.api.handlers.DataListener)3 ConnectionCallback (org.webpieces.nio.api.deprecated.ConnectionCallback)2 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 SSLEngine (javax.net.ssl.SSLEngine)1 ChannelServiceFactory (org.webpieces.nio.api.deprecated.ChannelServiceFactory)1 Settings (org.webpieces.nio.api.deprecated.Settings)1 AsyncSSLEngine (org.webpieces.nio.api.libs.AsyncSSLEngine)1 SSLEngineFactory (org.webpieces.nio.api.libs.SSLEngineFactory)1 MockSSLEngineFactory (org.webpieces.nio.api.testutil.MockSSLEngineFactory)1