Search in sources :

Example 11 with InjectionConfig

use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.

the class AbstractTest 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);
    localSettings.setInitialWindowSize(localSettings.getMaxFrameSize() * 4);
    config.setLocalSettings(localSettings);
    InjectionConfig injConfig = new InjectionConfig(mockTime, config);
    Http2Client client = Http2ClientFactory.createHttpClient(mockChanMgr, injConfig);
    mockChanMgr.addTCPChannelToReturn(mockChannel);
    httpSocket = client.createHttpSocket("simple");
    CompletableFuture<Http2Socket> connect = httpSocket.connect(new InetSocketAddress(555));
    Assert.assertTrue(connect.isDone());
    Assert.assertEquals(httpSocket, connect.get());
    //clear preface and settings frame from client
    mockChannel.getFramesAndClear();
    //server's settings frame is finally coming in as well with maxConcurrent=1
    sendAndAckSettingsFrame(1);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) Http2Socket(org.webpieces.http2client.api.Http2Socket) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) Http2Client(org.webpieces.http2client.api.Http2Client) Before(org.junit.Before)

Example 12 with InjectionConfig

use of com.webpieces.http2engine.api.client.InjectionConfig in project webpieces by deanhiller.

the class WebServerModule method providesAsyncServerMgr.

@Provides
@Singleton
public HttpFrontendManager providesAsyncServerMgr(ChannelManager chanMgr, ScheduledExecutorService timer, @Named(HttpFrontendFactory.HTTP2_ENGINE_THREAD_POOL) Executor executor1, BufferPool pool, Time time, WebServerConfig config) {
    HttpParser httpParser = HttpParserFactory.createParser(pool);
    HpackParser http2Parser = HpackParserFactory.createParser(pool, true);
    InjectionConfig injConfig = new InjectionConfig(http2Parser, time, config.getHttp2Config());
    return HttpFrontendFactory.createFrontEnd(chanMgr, timer, injConfig, httpParser);
}
Also used : HpackParser(com.webpieces.hpack.api.HpackParser) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) HttpParser(org.webpieces.httpparser.api.HttpParser) Singleton(javax.inject.Singleton) Provides(com.google.inject.Provides)

Aggregations

InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)12 Http2Config (com.webpieces.http2engine.api.client.Http2Config)9 InetSocketAddress (java.net.InetSocketAddress)7 Before (org.junit.Before)7 HpackParser (com.webpieces.hpack.api.HpackParser)5 Http2Client (org.webpieces.http2client.api.Http2Client)5 Http2Socket (org.webpieces.http2client.api.Http2Socket)5 Executor (java.util.concurrent.Executor)3 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)3 FrontendConfig (org.webpieces.frontend2.api.FrontendConfig)3 HttpFrontendManager (org.webpieces.frontend2.api.HttpFrontendManager)3 HttpServer (org.webpieces.frontend2.api.HttpServer)3 MockTcpServerChannel (org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel)3 ChannelManager (org.webpieces.nio.api.ChannelManager)3 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)3 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)3 TimeImpl (com.webpieces.util.time.TimeImpl)2 SSLEngine (javax.net.ssl.SSLEngine)2 HttpParser (org.webpieces.httpparser.api.HttpParser)2 Provides (com.google.inject.Provides)1