use of org.webpieces.nio.api.libs.SSLEngineFactory in project webpieces by deanhiller.
the class TestNewAsynchSSLEngine2 method setUp.
@Override
protected void setUp() throws Exception {
HandlerForTests.setupLogging();
serverList.setDefaultBehavior("packetEncrypted", new CloneByteBuffer());
clientList.setDefaultBehavior("packetEncrypted", new CloneByteBuffer());
SSLEngineFactory sslEngineFactory = new MockSSLEngineFactory();
FactoryCreator creator = FactoryCreator.createFactory(null);
SSLEngine wrappedSvr = sslEngineFactory.createEngineForServerSocket();
serverEngine = creator.createSSLEngine("[serverAsynch] ", wrappedSvr, null);
serverEngine.setListener((SSLListener) serverList);
SSLEngine wrappedClient = sslEngineFactory.createEngineForSocket();
clientEngine = creator.createSSLEngine("[clientEngine] ", wrappedClient, null);
clientEngine.setListener((SSLListener) clientList);
}
use of org.webpieces.nio.api.libs.SSLEngineFactory in project webpieces by deanhiller.
the class EventClient method start.
public void start() throws IOException, InterruptedException {
ChannelService mgr = ChannelServiceFactory.createDefaultChannelMgr("EventServer");
mgr.start();
SSLEngineFactory sslFactory = new MockSSLEngineFactory();
Settings h = new Settings(sslFactory, null);
TCPChannel channel = mgr.createTCPChannel("SvrChan", h);
InetAddress addr = InetAddress.getByName("192.168.1.102");
InetSocketAddress sockAddr = new InetSocketAddress(addr, 801);
log.info("Connecting to server=" + sockAddr);
channel.oldConnect(sockAddr, this);
}
use of org.webpieces.nio.api.libs.SSLEngineFactory 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);
}
use of org.webpieces.nio.api.libs.SSLEngineFactory in project webpieces by deanhiller.
the class EventServer method start.
public void start() throws IOException, InterruptedException {
log.info("Attempting to start server");
ChannelService mgr = ChannelServiceFactory.createDefaultChannelMgr("EventServer");
mgr.start();
SSLEngineFactory sslFactory = new MockSSLEngineFactory();
Settings h = new Settings(sslFactory, null);
TCPServerChannel svrChannel = mgr.createTCPServerChannel("SvrChan", h);
InetAddress addr = InetAddress.getByName("192.168.1.101");
InetSocketAddress sockAddr = new InetSocketAddress(addr, 801);
log.info("binding");
svrChannel.bind(sockAddr);
log.info("bound to=" + svrChannel.getLocalAddress());
svrChannel.registerServerSocketChannel(this);
log.info(svrChannel + "Server started");
}
use of org.webpieces.nio.api.libs.SSLEngineFactory in project webpieces by deanhiller.
the class TestNewAsynchSSLEngine method setUp.
@Override
protected void setUp() throws Exception {
HandlerForTests.setupLogging();
SSLEngineFactory sslEngineFactory = new MockSSLEngineFactory();
FactoryCreator creator = FactoryCreator.createFactory(null);
SSLEngine wrappedSvr = sslEngineFactory.createEngineForServerSocket();
serverEngine = creator.createSSLEngine("[serverAsynch] ", wrappedSvr, null);
serverEngine.setListener((SSLListener) serverList);
SSLEngine wrappedClient = sslEngineFactory.createEngineForSocket();
clientEngine = creator.createSSLEngine("[clientEngine] ", wrappedClient, null);
clientEngine.setListener((SSLListener) clientList);
}
Aggregations