Search in sources :

Example 1 with DefaultFullHttpResponse

use of com.couchbase.client.core.deps.io.netty.handler.codec.http.DefaultFullHttpResponse in project couchbase-jvm-clients by couchbase.

the class NonChunkedHttpMessageHandlerTest method callsMarkRequestCompletedOnceFinished.

@Test
void callsMarkRequestCompletedOnceFinished() throws Exception {
    channel.pipeline().addFirst(NonChunkedHttpMessageHandler.IDENTIFIER, new TestNonChunkedHttpMessageHandler(endpoint));
    channel.pipeline().fireChannelActive();
    CoreHttpRequest request = CoreHttpRequest.builder(CoreCommonOptions.of(Duration.ofSeconds(1), BestEffortRetryStrategy.INSTANCE, null), endpoint.context(), HttpMethod.GET, CoreHttpPath.path("/"), RequestTarget.views("bucket")).build();
    channel.writeAndFlush(request);
    FullHttpRequest written = channel.readOutbound();
    assertEquals("/", written.uri());
    FullHttpResponse response = new DefaultFullHttpResponse(HttpVersion.HTTP_1_1, HttpResponseStatus.OK);
    channel.writeInbound(response);
    assertEquals(ResponseStatus.SUCCESS, request.response().get().status());
    verify(endpoint, times(1)).markRequestCompletion();
}
Also used : DefaultFullHttpResponse(com.couchbase.client.core.deps.io.netty.handler.codec.http.DefaultFullHttpResponse) FullHttpRequest(com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest) CoreHttpRequest(com.couchbase.client.core.endpoint.http.CoreHttpRequest) FullHttpResponse(com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpResponse) DefaultFullHttpResponse(com.couchbase.client.core.deps.io.netty.handler.codec.http.DefaultFullHttpResponse) Test(org.junit.jupiter.api.Test)

Aggregations

DefaultFullHttpResponse (com.couchbase.client.core.deps.io.netty.handler.codec.http.DefaultFullHttpResponse)1 FullHttpRequest (com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpRequest)1 FullHttpResponse (com.couchbase.client.core.deps.io.netty.handler.codec.http.FullHttpResponse)1 CoreHttpRequest (com.couchbase.client.core.endpoint.http.CoreHttpRequest)1 Test (org.junit.jupiter.api.Test)1