Search in sources :

Example 11 with Http2Config

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

the class TestC3InitialHttpsConnections 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.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(engine, new SocketListener());
    XFuture<Void> connect = socket.connect(addr);
    connect.get(2, TimeUnit.SECONDS);
    // 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);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) SSLEngine(javax.net.ssl.SSLEngine) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) ForTestSslClientEngineFactory(org.webpieces.http2client.integ.ForTestSslClientEngineFactory) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) Http2Msg(com.webpieces.http2.api.dto.lowlevel.lib.Http2Msg) Http2Config(com.webpieces.http2engine.api.client.Http2Config) Preface(org.webpieces.http2client.mock.Preface) Http2Client(org.webpieces.http2client.api.Http2Client) Before(org.junit.Before)

Aggregations

Http2Config (com.webpieces.http2engine.api.client.Http2Config)11 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)11 InetSocketAddress (java.net.InetSocketAddress)9 Before (org.junit.Before)9 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)7 Http2Client (org.webpieces.http2client.api.Http2Client)5 HttpFrontendManager (org.webpieces.frontend2.api.HttpFrontendManager)4 HttpServer (org.webpieces.frontend2.api.HttpServer)4 MockTcpServerChannel (org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel)4 HttpSvrConfig (org.webpieces.frontend2.api.HttpSvrConfig)3 HpackParser (com.webpieces.hpack.api.HpackParser)2 TimeImpl (com.webpieces.util.time.TimeImpl)2 Executor (java.util.concurrent.Executor)2 ChannelManager (org.webpieces.nio.api.ChannelManager)2 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)2 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)2 Http2Msg (com.webpieces.http2.api.dto.lowlevel.lib.Http2Msg)1 Http2ServerEngineFactory (com.webpieces.http2engine.api.server.Http2ServerEngineFactory)1 SSLEngine (javax.net.ssl.SSLEngine)1 AsyncServerManager (org.webpieces.asyncserver.api.AsyncServerManager)1