Search in sources :

Example 1 with Http2CloseListener

use of org.webpieces.httpclient.Http2CloseListener in project webpieces by deanhiller.

the class TestCancelStream method setup.

@Before
public void setup() {
    SimpleMeterRegistry metrics = new SimpleMeterRegistry();
    TwoPools pool = new TwoPools("client.bufferpool", metrics);
    httpClient = Http2to11ClientFactory.createHttpClient("myClient2", mockChanMgr, new SimpleMeterRegistry(), pool);
    mockChannel.setConnectFuture(XFuture.completedFuture(null));
    mockChanMgr.addTCPChannelToReturn(mockChannel);
    httpSocket = httpClient.createHttpSocket(new Http2CloseListener());
}
Also used : Http2CloseListener(org.webpieces.httpclient.Http2CloseListener) TwoPools(org.webpieces.data.api.TwoPools) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Example 2 with Http2CloseListener

use of org.webpieces.httpclient.Http2CloseListener in project webpieces by deanhiller.

the class TestConnecting method testConnecting.

@Test
public void testConnecting() {
    mockChannelMgr.addTCPChannelToReturn(mockChannel);
    Http2Socket socket = httpClient.createHttpSocket(new Http2CloseListener());
    XFuture<Void> future1 = new XFuture<Void>();
    mockChannel.setConnectFuture(future1);
    XFuture<Void> future = socket.connect(new InetSocketAddress(8080));
    Assert.assertFalse(future.isDone());
    future1.complete(null);
    Assert.assertTrue(future.isDone());
}
Also used : Http2CloseListener(org.webpieces.httpclient.Http2CloseListener) XFuture(org.webpieces.util.futures.XFuture) InetSocketAddress(java.net.InetSocketAddress) Http2Socket(org.webpieces.http2client.api.Http2Socket) Test(org.junit.Test)

Example 3 with Http2CloseListener

use of org.webpieces.httpclient.Http2CloseListener in project webpieces by deanhiller.

the class TestWriteReads method setup.

@Before
public void setup() throws InterruptedException, ExecutionException, TimeoutException {
    BufferPool pool = new TwoPools("pl", new SimpleMeterRegistry());
    httpClient = Http2to11ClientFactory.createHttpClient("myClient4", mockChannelMgr, new SimpleMeterRegistry(), pool);
    mockChannelMgr.addTCPChannelToReturn(mockChannel);
    socket = httpClient.createHttpSocket(new Http2CloseListener());
    mockChannel.setConnectFuture(XFuture.completedFuture(null));
    XFuture<Void> future = socket.connect(new InetSocketAddress(8080));
    future.get(2, TimeUnit.SECONDS);
}
Also used : Http2CloseListener(org.webpieces.httpclient.Http2CloseListener) BufferPool(org.webpieces.data.api.BufferPool) TwoPools(org.webpieces.data.api.TwoPools) InetSocketAddress(java.net.InetSocketAddress) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Example 4 with Http2CloseListener

use of org.webpieces.httpclient.Http2CloseListener in project webpieces by deanhiller.

the class TestHttp1Backpressure method setup.

@Before
public void setup() throws InterruptedException, ExecutionException, TimeoutException {
    BufferPool pool = new TwoPools("pl", new SimpleMeterRegistry());
    httpClient = Http2to11ClientFactory.createHttpClient("myClient3", mockChannelMgr, new SimpleMeterRegistry(), pool);
    mockChannelMgr.addTCPChannelToReturn(mockChannel);
    socket = httpClient.createHttpSocket(new Http2CloseListener());
    mockChannel.setConnectFuture(XFuture.completedFuture(null));
    XFuture<Void> future = socket.connect(new InetSocketAddress(8080));
    future.get(2, TimeUnit.SECONDS);
}
Also used : Http2CloseListener(org.webpieces.httpclient.Http2CloseListener) BufferPool(org.webpieces.data.api.BufferPool) TwoPools(org.webpieces.data.api.TwoPools) InetSocketAddress(java.net.InetSocketAddress) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) Before(org.junit.Before)

Aggregations

Http2CloseListener (org.webpieces.httpclient.Http2CloseListener)4 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)3 InetSocketAddress (java.net.InetSocketAddress)3 Before (org.junit.Before)3 TwoPools (org.webpieces.data.api.TwoPools)3 BufferPool (org.webpieces.data.api.BufferPool)2 Test (org.junit.Test)1 Http2Socket (org.webpieces.http2client.api.Http2Socket)1 XFuture (org.webpieces.util.futures.XFuture)1