use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class AbstractHttp2Test method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockTcpChannel.setIncomingFrameDefaultReturnValue(CompletableFuture.completedFuture(mockTcpChannel));
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();
simulateClientSendingPrefaceAndSettings();
}
use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class AbstractFrontendHttp2Test method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockTcpChannel.setIncomingFrameDefaultReturnValue(XFuture.completedFuture(null));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
SimpleMeterRegistry metrics = new SimpleMeterRegistry();
InjectionConfig injConfig = new InjectionConfig(mockTime, config, metrics);
HttpSvrConfig frontendConfig = new HttpSvrConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig, Metrics.globalRegistry);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
simulateClientConnecting();
simulateClientSendingPrefaceAndSettings();
}
use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class TestC3InitialHttpConnections method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
mockChannel.setIncomingFrameDefaultReturnValue(XFuture.completedFuture(null));
Http2Config config = new Http2Config();
// start with 1 max concurrent
config.setInitialRemoteMaxConcurrent(1);
config.setLocalSettings(localSettings);
SimpleMeterRegistry metrics = new SimpleMeterRegistry();
InjectionConfig injConfig = new InjectionConfig(mockTime, config, metrics);
Http2Client client = Http2ClientFactory.createHttpClient("test2Client", mockChanMgr, injConfig);
mockChanMgr.addTCPChannelToReturn(mockChannel);
socket = client.createHttpSocket(new SocketListener());
XFuture<Void> connect = socket.connect(new InetSocketAddress(555));
connect.get(2, TimeUnit.SECONDS);
}
use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class HttpFrontendFactory method createFrontEnd.
/**
*
* @param id Use for logging and also file recording names
* @param threadPoolSize The size of the threadpool, although all data comes in order as we
* use the SessionExecutorImpl found in webpieces
*
* @return
*/
public static HttpFrontendManager createFrontEnd(String id, int threadPoolSize, ScheduledExecutorService timer, BufferPool pool) {
Executor executor = Executors.newFixedThreadPool(threadPoolSize, new NamedThreadFactory(id));
ChannelManagerFactory factory = ChannelManagerFactory.createFactory();
ChannelManager chanMgr = factory.createMultiThreadedChanMgr(id, pool, executor);
AsyncServerManager svrMgr = AsyncServerMgrFactory.createAsyncServer(chanMgr);
HttpParser httpParser = HttpParserFactory.createParser(pool);
HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
InjectionConfig injConfig = new InjectionConfig(http2Parser, new TimeImpl(), new Http2Config());
Http2ServerEngineFactory svrEngineFactory = new Http2ServerEngineFactory(injConfig);
return new FrontEndServerManagerImpl(svrMgr, timer, svrEngineFactory, httpParser);
}
use of com.webpieces.http2engine.api.client.Http2Config 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();
}
Aggregations