Search in sources :

Example 6 with Http2Client

use of org.webpieces.http2client.api.Http2Client 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();
}
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 7 with Http2Client

use of org.webpieces.http2client.api.Http2Client in project webpieces by deanhiller.

the class ThroughputEngine method runAsyncClient.

private void runAsyncClient(InetSocketAddress svrAddress, Protocol protocol, Clients creator) {
    Http2Client client = creator.createClient();
    ClientAsync async = new ClientAsync(client, config, protocol);
    async.runAsyncClient(svrAddress);
}
Also used : ClientAsync(org.webpieces.throughput.client.ClientAsync) Http2Client(org.webpieces.http2client.api.Http2Client)

Example 8 with Http2Client

use of org.webpieces.http2client.api.Http2Client in project webpieces by deanhiller.

the class Http11Clients method createClient.

@Override
public Http2Client createClient() {
    if (config.getClientThreadCount() != null)
        return Http2to11ClientFactory.createHttpClient("onlyClient", config.getClientThreadCount(), config.getBackpressureConfig(), metrics);
    // single threaded version...
    TwoPools pool = new TwoPools("pl", new SimpleMeterRegistry());
    ChannelManagerFactory factory = ChannelManagerFactory.createFactory(metrics);
    ChannelManager chanMgr = factory.createSingleThreadedChanMgr("clientCmLoop", pool, config.getBackpressureConfig());
    Http2Client client = Http2to11ClientFactory.createHttpClient("onlyClient", chanMgr, new SimpleMeterRegistry(), pool);
    return client;
}
Also used : ChannelManager(org.webpieces.nio.api.ChannelManager) TwoPools(org.webpieces.data.api.TwoPools) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Http2Client(org.webpieces.http2client.api.Http2Client) ChannelManagerFactory(org.webpieces.nio.api.ChannelManagerFactory)

Example 9 with Http2Client

use of org.webpieces.http2client.api.Http2Client 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();
}
Also used : InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) Http2Client(org.webpieces.http2client.api.Http2Client) Before(org.junit.Before)

Example 10 with Http2Client

use of org.webpieces.http2client.api.Http2Client 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);
}
Also used : InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) Http2Client(org.webpieces.http2client.api.Http2Client) Before(org.junit.Before)

Aggregations

Http2Client (org.webpieces.http2client.api.Http2Client)11 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)7 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)7 Http2Config (com.webpieces.http2engine.api.client.Http2Config)5 InetSocketAddress (java.net.InetSocketAddress)5 Before (org.junit.Before)5 SSLEngine (javax.net.ssl.SSLEngine)3 TwoPools (org.webpieces.data.api.TwoPools)3 Http2Socket (org.webpieces.http2client.api.Http2Socket)3 BackpressureConfig (org.webpieces.nio.api.BackpressureConfig)3 ChannelManager (org.webpieces.nio.api.ChannelManager)3 ChannelManagerFactory (org.webpieces.nio.api.ChannelManagerFactory)3 HpackParser (com.webpieces.hpack.api.HpackParser)2 Executor (java.util.concurrent.Executor)2 BufferPool (org.webpieces.data.api.BufferPool)2 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)2 Injector (com.google.inject.Injector)1 Provides (com.google.inject.Provides)1 Http2Msg (com.webpieces.http2.api.dto.lowlevel.lib.Http2Msg)1 IOException (java.io.IOException)1