use of com.webpieces.http2engine.api.client.Http2Config 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.Http2Config 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(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();
}
use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class TestS3InitialHttpConnections 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();
ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
XFuture<DataListener> futureList = listener.connected(mockTcpChannel, true);
DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
mockChannel.setDataListener(dataListener);
}
use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class TestC6x5SettingsFrameErrors 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);
// clear preface and settings frame from client
mockChannel.getFramesAndClear();
}
use of com.webpieces.http2engine.api.client.Http2Config in project webpieces by deanhiller.
the class AbstractTest 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);
localSettings.setInitialWindowSize(localSettings.getMaxFrameSize() * 4);
config.setLocalSettings(localSettings);
SimpleMeterRegistry metrics = new SimpleMeterRegistry();
InjectionConfig injConfig = new InjectionConfig(mockTime, config, metrics);
Http2Client client = Http2ClientFactory.createHttpClient("test2Client", mockChanMgr, injConfig);
mockChanMgr.addTCPChannelToReturn(mockChannel);
httpSocket = client.createHttpSocket(new SocketListener());
XFuture<Void> connect = httpSocket.connect(new InetSocketAddress(555));
connect.get(2, TimeUnit.SECONDS);
// clear preface and settings frame from client
mockChannel.getFramesAndClear();
// server's settings frame is finally coming in as well with maxConcurrent=1
sendAndAckSettingsFrame(1);
}
Aggregations