use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.
the class AbstractHttp1Test method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockChannel.setIncomingFrameDefaultReturnValue(CompletableFuture.completedFuture(mockChannel));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
FrontendConfig frontendConfig = new FrontendConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
simulateClientConnecting();
}
use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.
the class TestC3InitialHttpsConnections method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException {
mockChannel.setIncomingFrameDefaultReturnValue(CompletableFuture.completedFuture(mockChannel));
Http2Config config = new Http2Config();
//start with 1 max concurrent
config.setInitialRemoteMaxConcurrent(1);
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
Http2Client client = Http2ClientFactory.createHttpClient(mockChanMgr, injConfig);
mockChanMgr.addSSLChannelToReturn(mockChannel);
InetSocketAddress addr = new InetSocketAddress("somehost.com", 555);
String host = addr.getHostName();
int port = addr.getPort();
ForTestSslClientEngineFactory ssl = new ForTestSslClientEngineFactory();
SSLEngine engine = ssl.createSslEngine(host, port);
socket = client.createHttpsSocket("simple", engine);
CompletableFuture<Http2Socket> connect = socket.connect(addr);
Assert.assertTrue(connect.isDone());
Assert.assertEquals(socket, connect.get());
//verify settings on connect were sent
//verify settings on connect were sent
List<Http2Msg> frames = mockChannel.getFramesAndClear();
Preface preface = (Preface) frames.get(0);
preface.verify();
Http2Msg settings1 = frames.get(1);
Assert.assertEquals(HeaderSettings.createSettingsFrame(localSettings), settings1);
}
use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.
the class TestC6_5SettingsFrameErrors method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException {
mockChannel.setIncomingFrameDefaultReturnValue(CompletableFuture.completedFuture(mockChannel));
Http2Config config = new Http2Config();
//start with 1 max concurrent
config.setInitialRemoteMaxConcurrent(1);
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
Http2Client client = Http2ClientFactory.createHttpClient(mockChanMgr, injConfig);
mockChanMgr.addTCPChannelToReturn(mockChannel);
socket = client.createHttpSocket("simple");
CompletableFuture<Http2Socket> connect = socket.connect(new InetSocketAddress(555));
Assert.assertTrue(connect.isDone());
Assert.assertEquals(socket, connect.get());
//clear preface and settings frame from client
mockChannel.getFramesAndClear();
}
use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.
the class Http2ClientFactory method createHttpClient.
public static Http2Client createHttpClient(int numThreads) {
Http2Config config = new Http2Config();
Executor executor = Executors.newFixedThreadPool(numThreads, new NamedThreadFactory("httpclient"));
BufferCreationPool pool = new BufferCreationPool();
HpackParser hpackParser = HpackParserFactory.createParser(pool, false);
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager mgr = factory.createMultiThreadedChanMgr("httpClientChanMgr", pool, executor);
InjectionConfig injConfig = new InjectionConfig(hpackParser, new TimeImpl(), config);
return createHttpClient(mgr, injConfig);
}
use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.
the class Http2ClientFactory method createHttpClient.
public static Http2Client createHttpClient(Http2Config config, ChannelManager mgr, Executor executor, Time time) {
BufferCreationPool pool = new BufferCreationPool();
HpackParser hpackParser = HpackParserFactory.createParser(pool, false);
InjectionConfig injConfig = new InjectionConfig(hpackParser, time, config);
return createHttpClient(mgr, injConfig);
}
Aggregations