use of org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn in project webpieces by deanhiller.
the class AbstractHttp2Test method sendRequestToServer.
protected PassedIn sendRequestToServer(int streamId, boolean eos) {
Http2Request request1 = Http2Requests.createRequest(streamId, eos);
mockChannel.send(request1);
PassedIn req = mockListener.getSingleRequest();
Assert.assertEquals(request1, req.request);
return req;
}
use of org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn in project webpieces by deanhiller.
the class TestSBasicRequestResponse method testPushPromise.
@Test
public void testPushPromise() throws InterruptedException, ExecutionException, TimeoutException {
Http2Request request1 = Http2Requests.createRequest(1, true);
mockChannel.send(request1);
PassedIn incoming = mockListener.getSingleRequest();
Assert.assertEquals(request1, incoming.request);
Http2Push push = Http2Requests.createPush(request1.getStreamId());
CompletableFuture<PushPromiseListener> future = incoming.stream.openPushStream().process(push);
PushPromiseListener pushWriter = future.get(2, TimeUnit.SECONDS);
Http2Push pushRecv = (Http2Push) mockChannel.getFrameAndClear();
Assert.assertEquals(push, pushRecv);
Http2Response preEmptive = Http2Requests.createResponse(push.getPromisedStreamId());
pushWriter.processPushResponse(preEmptive);
Http2Headers preEmptRecv = (Http2Headers) mockChannel.getFrameAndClear();
Assert.assertEquals(preEmptive, preEmptRecv);
Http2Response response = Http2Requests.createResponse(request1.getStreamId());
incoming.stream.sendResponse(response);
Http2Headers responseRecv = (Http2Headers) mockChannel.getFrameAndClear();
Assert.assertEquals(response, responseRecv);
}
use of org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn in project webpieces by deanhiller.
the class TestSBasicRequestResponse method testWithNoData.
@Test
public void testWithNoData() throws InterruptedException, ExecutionException, TimeoutException {
Http2Request request1 = Http2Requests.createRequest(1, true);
mockChannel.send(request1);
PassedIn incoming = mockListener.getSingleRequest();
Assert.assertEquals(request1, incoming.request);
Http2Response resp = Http2Requests.createResponse(request1.getStreamId(), true);
incoming.stream.sendResponse(resp);
Http2Msg response = mockChannel.getFrameAndClear();
Assert.assertEquals(resp, response);
}
Aggregations