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();
}
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);
}
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;
}
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();
}
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);
}
Aggregations