use of org.webpieces.data.api.BufferPool in project webpieces by deanhiller.
the class TestSSLEngineClose method setup.
@Before
public void setup() throws GeneralSecurityException, IOException {
MockSSLEngineFactory sslEngineFactory = new MockSSLEngineFactory();
BufferPool pool = new BufferCreationPool(false, 17000, 1000);
SSLEngine client = sslEngineFactory.createEngineForSocket();
SSLEngine svr = sslEngineFactory.createEngineForServerSocket();
clientEngine = AsyncSSLFactory.create("client", client, pool, clientListener);
svrEngine = AsyncSSLFactory.create("svr", svr, pool, svrListener);
clientEngine.beginHandshake();
ByteBuffer buffer = clientListener.getToSendToSocket().get(0);
svrEngine.feedEncryptedPacket(buffer);
svrListener.getRunnable().run();
ByteBuffer buf = svrListener.getToSendToSocket().get(0);
clientEngine.feedEncryptedPacket(buf);
clientListener.getRunnable().run();
List<ByteBuffer> buffers = clientListener.getToSendToSocket();
svrEngine.feedEncryptedPacket(buffers.get(0));
svrListener.getRunnable().run();
svrEngine.feedEncryptedPacket(buffers.get(1));
svrEngine.feedEncryptedPacket(buffers.get(2));
Assert.assertTrue(svrListener.connected);
List<ByteBuffer> toClientBuffers = svrListener.getToSendToSocket();
clientEngine.feedEncryptedPacket(toClientBuffers.get(0));
clientEngine.feedEncryptedPacket(toClientBuffers.get(1));
Assert.assertTrue(clientListener.connected);
transferBigData();
}
use of org.webpieces.data.api.BufferPool in project webpieces by deanhiller.
the class IntegGoogleHttps method createHttpClient.
public static HttpClient createHttpClient() {
BufferPool pool2 = new BufferCreationPool();
Executor executor2 = Executors.newFixedThreadPool(10, new NamedThreadFactory("clientThread"));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("client", pool2, executor2);
HttpParser parser = HttpParserFactory.createParser(pool2);
HttpClient client = HttpClientFactory.createHttpClient(mgr, parser);
return client;
}
Aggregations