Search in sources :

Example 6 with MockSSLEngineFactory

use of org.webpieces.nio.api.testutil.MockSSLEngineFactory in project webpieces by deanhiller.

the class TestMoreSecureChanMgr method setUp.

protected void setUp() throws Exception {
    SSLEngineFactory sslEngineFactory = new MockSSLEngineFactory();
    Settings clientFactoryHolder = new Settings(sslEngineFactory, null);
    //use this engine to feed data back from server...
    SSLEngine wrappedSvr = sslEngineFactory.createEngineForServerSocket();
    sslEngine = creator.createSSLEngine("[serverAsynch] ", wrappedSvr, null);
    sslEngine.setListener((SSLListener) mockSSLListener);
    //and started back up cleanly.....		
    if (chanMgr == null) {
        chanMgr = getClientChanMgr();
    }
    if (mockServer == null) {
        ChannelService svcChanMgr = getServerChanMgr();
        mockServer = new MockNIOServer(svcChanMgr, null);
    }
    chanMgr.start();
    svrAddr = mockServer.start();
    log.trace("server port =" + svrAddr);
    loopBack = InetAddress.getByName("127.0.0.1");
    loopBackAnyPort = new InetSocketAddress(loopBack, 0);
    mockHandler.setDefaultBehavior("incomingData", new CloneByteBuffer());
    mockSSLListener.setDefaultBehavior("packetEncrypted", new CloneByteBuffer());
    client1 = chanMgr.createTCPChannel("ClientChannel", clientFactoryHolder);
}
Also used : AsyncSSLEngine(org.webpieces.nio.api.libs.AsyncSSLEngine) SSLEngine(javax.net.ssl.SSLEngine) ChannelService(org.webpieces.nio.api.deprecated.ChannelService) InetSocketAddress(java.net.InetSocketAddress) CloneByteBuffer(org.webpieces.nio.api.testutil.CloneByteBuffer) MockNIOServer(org.webpieces.nio.api.testutil.MockNIOServer) SSLEngineFactory(org.webpieces.nio.api.libs.SSLEngineFactory) MockSSLEngineFactory(org.webpieces.nio.api.testutil.MockSSLEngineFactory) Settings(org.webpieces.nio.api.deprecated.Settings) MockSSLEngineFactory(org.webpieces.nio.api.testutil.MockSSLEngineFactory)

Aggregations

MockSSLEngineFactory (org.webpieces.nio.api.testutil.MockSSLEngineFactory)6 SSLEngineFactory (org.webpieces.nio.api.libs.SSLEngineFactory)5 InetSocketAddress (java.net.InetSocketAddress)4 Settings (org.webpieces.nio.api.deprecated.Settings)4 InetAddress (java.net.InetAddress)3 SSLEngine (javax.net.ssl.SSLEngine)3 ChannelService (org.webpieces.nio.api.deprecated.ChannelService)3 AsyncSSLEngine (org.webpieces.nio.api.libs.AsyncSSLEngine)3 TCPChannel (org.webpieces.nio.api.channels.TCPChannel)2 FactoryCreator (org.webpieces.nio.api.libs.FactoryCreator)2 CloneByteBuffer (org.webpieces.nio.api.testutil.CloneByteBuffer)2 MockObject (biz.xsoftware.mock.MockObject)1 TCPServerChannel (org.webpieces.nio.api.channels.TCPServerChannel)1 MockDataHandler (org.webpieces.nio.api.testutil.MockDataHandler)1 MockNIOServer (org.webpieces.nio.api.testutil.MockNIOServer)1