Search in sources :

Example 26 with Buffer

use of io.servicetalk.buffer.api.Buffer in project servicetalk by apple.

the class ExpectContinueTest method serverError.

@ParameterizedTest(name = "protocol={0} withCL={1}")
@MethodSource("arguments")
void serverError(HttpProtocol protocol, boolean withCL) throws Exception {
    try (HttpServerContext serverContext = startServer(protocol, (ctx, request, response) -> {
        requestReceived.countDown();
        returnResponse.await();
        if (request.headers().contains(EXPECT, CONTINUE)) {
            response.status(INTERNAL_SERVER_ERROR);
        }
        response.sendMetaData().close();
    });
        StreamingHttpClient client = createClient(serverContext, protocol);
        StreamingHttpConnection connection = client.reserveConnection(client.get("/")).toFuture().get()) {
        TestPublisher<Buffer> payload = new TestPublisher.Builder<Buffer>().singleSubscriber().build();
        connection.request(newRequest(connection, withCL, true, payload)).subscribe(responses::add);
        requestReceived.await();
        assertThat("Unexpected subscribe to payload body before 100 (Continue)", payload.isSubscribed(), is(false));
        returnResponse.countDown();
        assertResponse(INTERNAL_SERVER_ERROR, "");
        // send a follow-up request on the same connection:
        connection.request(connection.get("/")).subscribe(responses::add);
        assertResponse(OK, "");
    }
}
Also used : Buffer(io.servicetalk.buffer.api.Buffer) StreamingHttpClient(io.servicetalk.http.api.StreamingHttpClient) RedirectConfigBuilder(io.servicetalk.http.api.RedirectConfigBuilder) SingleAddressHttpClientBuilder(io.servicetalk.http.api.SingleAddressHttpClientBuilder) HttpServerContext(io.servicetalk.http.api.HttpServerContext) StreamingHttpConnection(io.servicetalk.http.api.StreamingHttpConnection) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Example 27 with Buffer

use of io.servicetalk.buffer.api.Buffer in project servicetalk by apple.

the class HttpConnectionEmptyPayloadTest method headRequestContentEmpty.

@Test
void headRequestContentEmpty() throws Exception {
    try (CompositeCloseable closeable = AsyncCloseables.newCompositeCloseable()) {
        final int expectedContentLength = 128;
        byte[] expectedPayload = new byte[expectedContentLength];
        ThreadLocalRandom.current().nextBytes(expectedPayload);
        ServerContext serverContext = closeable.merge(HttpServers.forAddress(localAddress(0)).ioExecutor(executionContextRule.ioExecutor()).executionStrategy(offloadNone()).listenStreamingAndAwait((ctx, req, factory) -> {
            StreamingHttpResponse resp = factory.ok().payloadBody(from(HEAD.equals(req.method()) ? EMPTY_BUFFER : ctx.executionContext().bufferAllocator().newBuffer(expectedContentLength).writeBytes(expectedPayload)));
            resp.addHeader(CONTENT_LENGTH, String.valueOf(expectedContentLength));
            return succeeded(resp);
        }));
        StreamingHttpClient client = closeable.merge(forResolvedAddress(serverHostAndPort(serverContext)).ioExecutor(executionContextRule.ioExecutor()).protocols(h1().maxPipelinedRequests(3).build()).executor(executionContextRule.executor()).executionStrategy(defaultStrategy()).buildStreaming());
        StreamingHttpConnection connection = closeable.merge(client.reserveConnection(client.get("/")).toFuture().get());
        // Request HEAD, GET, HEAD to verify that we can keep reading data despite a HEAD request providing a hint
        // about content-length (and not actually providing the content).
        Single<StreamingHttpResponse> response1Single = connection.request(connection.newRequest(HEAD, "/"));
        Single<StreamingHttpResponse> response2Single = connection.request(connection.get("/"));
        Single<StreamingHttpResponse> response3Single = connection.request(connection.newRequest(HEAD, "/"));
        StreamingHttpResponse response = awaitIndefinitelyNonNull(response1Single);
        assertEquals(OK, response.status());
        CharSequence contentLength = response.headers().get(CONTENT_LENGTH);
        assertNotNull(contentLength);
        assertEquals(expectedContentLength, parseInt(contentLength.toString()));
        // Drain the current response content so we will be able to read the next response.
        response.messageBody().ignoreElements().toFuture().get();
        response = awaitIndefinitelyNonNull(response2Single);
        assertEquals(OK, response.status());
        contentLength = response.headers().get(CONTENT_LENGTH);
        assertNotNull(contentLength);
        assertEquals(expectedContentLength, parseInt(contentLength.toString()));
        Buffer buffer = awaitIndefinitelyNonNull(response.payloadBody().collect(() -> connection.connectionContext().executionContext().bufferAllocator().newBuffer(), Buffer::writeBytes));
        byte[] actualBytes = new byte[buffer.readableBytes()];
        buffer.readBytes(actualBytes);
        assertArrayEquals(expectedPayload, actualBytes);
        response = awaitIndefinitelyNonNull(response3Single);
        assertEquals(OK, response.status());
        contentLength = response.headers().get(CONTENT_LENGTH);
        assertNotNull(contentLength);
        assertEquals(expectedContentLength, parseInt(contentLength.toString()));
        response.messageBody().ignoreElements().toFuture().get();
    }
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) EMPTY_BUFFER(io.servicetalk.buffer.api.EmptyBuffer.EMPTY_BUFFER) HttpExecutionStrategies.defaultStrategy(io.servicetalk.http.api.HttpExecutionStrategies.defaultStrategy) StreamingHttpClient(io.servicetalk.http.api.StreamingHttpClient) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) HEAD(io.servicetalk.http.api.HttpRequestMethod.HEAD) Single.succeeded(io.servicetalk.concurrent.api.Single.succeeded) ThreadLocalRandom(java.util.concurrent.ThreadLocalRandom) BlockingTestUtils.awaitIndefinitelyNonNull(io.servicetalk.concurrent.api.BlockingTestUtils.awaitIndefinitelyNonNull) HttpExecutionStrategies.offloadNone(io.servicetalk.http.api.HttpExecutionStrategies.offloadNone) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) Publisher.from(io.servicetalk.concurrent.api.Publisher.from) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) ExecutionContextExtension.immediate(io.servicetalk.transport.netty.internal.ExecutionContextExtension.immediate) ServerContext(io.servicetalk.transport.api.ServerContext) HttpProtocolConfigs.h1(io.servicetalk.http.netty.HttpProtocolConfigs.h1) StreamingHttpConnection(io.servicetalk.http.api.StreamingHttpConnection) Single(io.servicetalk.concurrent.api.Single) CompositeCloseable(io.servicetalk.concurrent.api.CompositeCloseable) ExecutionContextExtension(io.servicetalk.transport.netty.internal.ExecutionContextExtension) CONTENT_LENGTH(io.servicetalk.http.api.HttpHeaderNames.CONTENT_LENGTH) OK(io.servicetalk.http.api.HttpResponseStatus.OK) Integer.parseInt(java.lang.Integer.parseInt) HttpClients.forResolvedAddress(io.servicetalk.http.netty.HttpClients.forResolvedAddress) Test(org.junit.jupiter.api.Test) Assertions.assertArrayEquals(org.junit.jupiter.api.Assertions.assertArrayEquals) Buffer(io.servicetalk.buffer.api.Buffer) AsyncCloseables(io.servicetalk.concurrent.api.AsyncCloseables) Buffer(io.servicetalk.buffer.api.Buffer) StreamingHttpClient(io.servicetalk.http.api.StreamingHttpClient) ServerContext(io.servicetalk.transport.api.ServerContext) CompositeCloseable(io.servicetalk.concurrent.api.CompositeCloseable) StreamingHttpConnection(io.servicetalk.http.api.StreamingHttpConnection) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) Test(org.junit.jupiter.api.Test)

Example 28 with Buffer

use of io.servicetalk.buffer.api.Buffer in project servicetalk by apple.

the class HttpLifecycleObserverTest method testClientCancelsRequestAfterResponse.

@ParameterizedTest(name = "{displayName} [{index}] protocol={0}")
@EnumSource(HttpProtocol.class)
void testClientCancelsRequestAfterResponse(HttpProtocol protocol) throws Exception {
    TestPublisher<Buffer> serverResponsePayload = new TestPublisher<>();
    serviceFilterFactory(service -> new StreamingHttpServiceFilter(service) {

        @Override
        public Single<StreamingHttpResponse> handle(HttpServiceContext ctx, StreamingHttpRequest request, StreamingHttpResponseFactory responseFactory) {
            return request.payloadBody().ignoreElements().concat(succeeded(responseFactory.ok().payloadBody(serverResponsePayload)));
        }
    });
    setUp(protocol);
    StreamingHttpConnection connection = streamingHttpConnection();
    StreamingHttpRequest request = connection.post("/").payloadBody(Publisher.from(CONTENT.duplicate())).transform(// adds empty trailers
    new StatelessTrailersTransformer<>());
    StreamingHttpResponse response = connection.request(request).toFuture().get();
    assertResponse(response, protocol.version, OK);
    Future<Collection<Buffer>> payload = response.payloadBody().toFuture();
    payload.cancel(true);
    if (protocol == HttpProtocol.HTTP_1) {
        // wait for cancellation to close the connection:
        connection.onClose().toFuture().get();
    }
    // try to write server content to trigger write failure and close the server-side connection:
    serverResponsePayload.onNext(CONTENT.duplicate());
    bothTerminate.await();
    clientInOrder.verify(clientLifecycleObserver).onNewExchange();
    clientInOrder.verify(clientExchangeObserver).onConnectionSelected(any(ConnectionInfo.class));
    clientInOrder.verify(clientExchangeObserver).onRequest(any(StreamingHttpRequest.class));
    clientInOrder.verify(clientExchangeObserver).onResponse(any(StreamingHttpResponse.class));
    clientInOrder.verify(clientResponseObserver, atLeastOnce()).onResponseDataRequested(anyLong());
    clientInOrder.verify(clientResponseObserver).onResponseCancel();
    verify(clientRequestObserver, atLeastOnce()).onRequestDataRequested(anyLong());
    clientRequestInOrder.verify(clientRequestObserver).onRequestData(any(Buffer.class));
    clientRequestInOrder.verify(clientRequestObserver).onRequestTrailers(any(HttpHeaders.class));
    clientRequestInOrder.verify(clientRequestObserver).onRequestComplete();
    clientInOrder.verify(clientExchangeObserver).onExchangeFinally();
    verifyNoMoreInteractions(clientLifecycleObserver, clientExchangeObserver, clientRequestObserver, clientResponseObserver);
    serverInOrder.verify(serverLifecycleObserver).onNewExchange();
    serverInOrder.verify(serverExchangeObserver).onConnectionSelected(any(ConnectionInfo.class));
    serverInOrder.verify(serverExchangeObserver).onRequest(any(StreamingHttpRequest.class));
    serverInOrder.verify(serverExchangeObserver).onResponse(any(StreamingHttpResponse.class));
    verify(serverResponseObserver, atLeastOnce()).onResponseDataRequested(anyLong());
    verify(serverResponseObserver, atMostOnce()).onResponseData(any(Buffer.class));
    serverInOrder.verify(serverResponseObserver).onResponseCancel();
    serverRequestInOrder.verify(serverRequestObserver, atLeastOnce()).onRequestDataRequested(anyLong());
    serverRequestInOrder.verify(serverRequestObserver).onRequestData(any(Buffer.class));
    serverRequestInOrder.verify(serverRequestObserver).onRequestComplete();
    serverInOrder.verify(serverExchangeObserver).onExchangeFinally();
    verifyNoMoreInteractions(serverLifecycleObserver, serverExchangeObserver, serverRequestObserver, serverResponseObserver);
}
Also used : Buffer(io.servicetalk.buffer.api.Buffer) HttpHeaders(io.servicetalk.http.api.HttpHeaders) TestPublisher(io.servicetalk.concurrent.api.TestPublisher) StreamingHttpResponseFactory(io.servicetalk.http.api.StreamingHttpResponseFactory) StreamingHttpServiceFilter(io.servicetalk.http.api.StreamingHttpServiceFilter) Single(io.servicetalk.concurrent.api.Single) HttpServiceContext(io.servicetalk.http.api.HttpServiceContext) Collection(java.util.Collection) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) ConnectionInfo(io.servicetalk.transport.api.ConnectionInfo) StreamingHttpConnection(io.servicetalk.http.api.StreamingHttpConnection) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) EnumSource(org.junit.jupiter.params.provider.EnumSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 29 with Buffer

use of io.servicetalk.buffer.api.Buffer in project servicetalk by apple.

the class ClientEffectiveStrategyTest method getResponse.

private String getResponse(ClientType clientType, StreamingHttpClient client) throws Exception {
    switch(clientType) {
        case Blocking:
            BlockingHttpClient blockingClient = client.asBlockingClient();
            return blockingClient.request(blockingClient.get("/")).payloadBody().toString(StandardCharsets.US_ASCII);
        case BlockingStreaming:
            BlockingStreamingHttpClient blockingStreamingClient = client.asBlockingStreamingClient();
            Supplier<CompositeBuffer> supplier = client.executionContext().bufferAllocator()::newCompositeBuffer;
            return StreamSupport.stream(blockingStreamingClient.request(blockingStreamingClient.get("/")).payloadBody().spliterator(), false).reduce((Buffer base, Buffer buffer) -> (base instanceof CompositeBuffer ? ((CompositeBuffer) base) : supplier.get().addBuffer(base)).addBuffer(buffer)).map(buffer -> buffer.toString(StandardCharsets.US_ASCII)).orElse("");
        case AsyncStreaming:
            return client.request(client.get("/")).flatMap(resp -> resp.payloadBody().collect(() -> client.executionContext().bufferAllocator().newCompositeBuffer(), CompositeBuffer::addBuffer)).toFuture().get().toString(StandardCharsets.US_ASCII);
        case Async:
            HttpClient httpClient = client.asClient();
            return httpClient.request(httpClient.get("/")).toFuture().get().payloadBody().toString(StandardCharsets.US_ASCII);
        default:
            fail("Unexpected client type " + clientType);
            /* NOTREACHED */
            return "failed";
    }
}
Also used : Buffer(io.servicetalk.buffer.api.Buffer) CompositeBuffer(io.servicetalk.buffer.api.CompositeBuffer) CoreMatchers.is(org.hamcrest.CoreMatchers.is) TestUtils.assertNoAsyncErrors(io.servicetalk.test.resources.TestUtils.assertNoAsyncErrors) FilterableStreamingHttpClient(io.servicetalk.http.api.FilterableStreamingHttpClient) ResponseData(io.servicetalk.http.netty.ClientEffectiveStrategyTest.ClientOffloadPoint.ResponseData) StreamingHttpConnectionFilterFactory(io.servicetalk.http.api.StreamingHttpConnectionFilterFactory) LoadBalancer(io.servicetalk.client.api.LoadBalancer) ServiceDiscovererEvent(io.servicetalk.client.api.ServiceDiscovererEvent) AfterAll(org.junit.jupiter.api.AfterAll) HttpExecutionStrategies.defaultStrategy(io.servicetalk.http.api.HttpExecutionStrategies.defaultStrategy) StreamingHttpClient(io.servicetalk.http.api.StreamingHttpClient) HttpExecutionStrategies.offloadNone(io.servicetalk.http.api.HttpExecutionStrategies.offloadNone) EnumSet(java.util.EnumSet) MethodSource(org.junit.jupiter.params.provider.MethodSource) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) ExecutionMode(org.junit.jupiter.api.parallel.ExecutionMode) Collection(java.util.Collection) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) StreamingHttpClientFilter(io.servicetalk.http.api.StreamingHttpClientFilter) StreamingHttpConnectionFilter(io.servicetalk.http.api.StreamingHttpConnectionFilter) Arguments(org.junit.jupiter.params.provider.Arguments) InetSocketAddress(java.net.InetSocketAddress) LinkedBlockingQueue(java.util.concurrent.LinkedBlockingQueue) FilterableStreamingHttpLoadBalancedConnection(io.servicetalk.http.api.FilterableStreamingHttpLoadBalancedConnection) StandardCharsets(java.nio.charset.StandardCharsets) List(java.util.List) Buffer(io.servicetalk.buffer.api.Buffer) Stream(java.util.stream.Stream) HttpExecutionStrategies.offloadAll(io.servicetalk.http.api.HttpExecutionStrategies.offloadAll) ResponseMeta(io.servicetalk.http.netty.ClientEffectiveStrategyTest.ClientOffloadPoint.ResponseMeta) RoundRobinLoadBalancerFactory(io.servicetalk.loadbalancer.RoundRobinLoadBalancerFactory) Queue(java.util.Queue) Assertions.fail(org.junit.jupiter.api.Assertions.fail) RequestPayloadSubscription(io.servicetalk.http.netty.ClientEffectiveStrategyTest.ClientOffloadPoint.RequestPayloadSubscription) LoadBalancerFactory(io.servicetalk.client.api.LoadBalancerFactory) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) Publisher(io.servicetalk.concurrent.api.Publisher) StreamingHttpRequester(io.servicetalk.http.api.StreamingHttpRequester) FilterableStreamingHttpConnection(io.servicetalk.http.api.FilterableStreamingHttpConnection) HttpLoadBalancerFactory(io.servicetalk.http.api.HttpLoadBalancerFactory) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) IoThreadFactory(io.servicetalk.transport.api.IoThreadFactory) ExecutionStrategy(io.servicetalk.transport.api.ExecutionStrategy) HttpExecutionStrategies(io.servicetalk.http.api.HttpExecutionStrategies) HttpExecutionStrategy(io.servicetalk.http.api.HttpExecutionStrategy) HttpClient(io.servicetalk.http.api.HttpClient) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) StreamSupport(java.util.stream.StreamSupport) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HttpServerBuilder(io.servicetalk.http.api.HttpServerBuilder) Nullable(javax.annotation.Nullable) ConnectionFactory(io.servicetalk.client.api.ConnectionFactory) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) ServerContext(io.servicetalk.transport.api.ServerContext) Single(io.servicetalk.concurrent.api.Single) Matchers(org.hamcrest.Matchers) CompositeBuffer(io.servicetalk.buffer.api.CompositeBuffer) BlockingStreamingHttpClient(io.servicetalk.http.api.BlockingStreamingHttpClient) SingleAddressHttpClientBuilder(io.servicetalk.http.api.SingleAddressHttpClientBuilder) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) StreamingHttpClientFilterFactory(io.servicetalk.http.api.StreamingHttpClientFilterFactory) Execution(org.junit.jupiter.api.parallel.Execution) HostAndPort(io.servicetalk.transport.api.HostAndPort) HttpExecutionStrategies.offloadNever(io.servicetalk.http.api.HttpExecutionStrategies.offloadNever) BlockingStreamingHttpClient(io.servicetalk.http.api.BlockingStreamingHttpClient) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) CompositeBuffer(io.servicetalk.buffer.api.CompositeBuffer) FilterableStreamingHttpClient(io.servicetalk.http.api.FilterableStreamingHttpClient) StreamingHttpClient(io.servicetalk.http.api.StreamingHttpClient) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) HttpClient(io.servicetalk.http.api.HttpClient) BlockingStreamingHttpClient(io.servicetalk.http.api.BlockingStreamingHttpClient)

Example 30 with Buffer

use of io.servicetalk.buffer.api.Buffer in project servicetalk by apple.

the class BlockingStreamingToStreamingServiceTest method throwAfterSendMetaData.

@Test
void throwAfterSendMetaData() throws Exception {
    CountDownLatch onErrorLatch = new CountDownLatch(1);
    AtomicReference<Throwable> throwableRef = new AtomicReference<>();
    BlockingStreamingHttpService syncService = (ctx, request, response) -> {
        response.sendMetaData();
        throw DELIBERATE_EXCEPTION;
    };
    StreamingHttpService asyncService = toStreamingHttpService(syncService, offloadNone()).adaptor();
    StreamingHttpResponse asyncResponse = asyncService.handle(mockCtx, reqRespFactory.get("/"), reqRespFactory).subscribeOn(executorExtension.executor()).toFuture().get();
    assertMetaData(OK, asyncResponse);
    toSource(asyncResponse.payloadBody()).subscribe(new Subscriber<Buffer>() {

        @Override
        public void onSubscribe(final Subscription s) {
        }

        @Override
        public void onNext(final Buffer s) {
        }

        @Override
        public void onError(final Throwable t) {
            throwableRef.set(t);
            onErrorLatch.countDown();
        }

        @Override
        public void onComplete() {
        }
    });
    onErrorLatch.await();
    assertThat(throwableRef.get(), is(DELIBERATE_EXCEPTION));
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) PlatformDependent.throwException(io.servicetalk.utils.internal.PlatformDependent.throwException) BiFunction(java.util.function.BiFunction) SingleSource(io.servicetalk.concurrent.SingleSource) ServiceAdapterHolder(io.servicetalk.http.api.HttpApiConversions.ServiceAdapterHolder) ExtendWith(org.junit.jupiter.api.extension.ExtendWith) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Executor(io.servicetalk.concurrent.api.Executor) HttpExecutionStrategies.offloadNone(io.servicetalk.http.api.HttpExecutionStrategies.offloadNone) MockitoExtension(org.mockito.junit.jupiter.MockitoExtension) ExecutorExtension(io.servicetalk.concurrent.api.ExecutorExtension) PayloadWriter(io.servicetalk.oio.api.PayloadWriter) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) Collection(java.util.Collection) Collectors(java.util.stream.Collectors) Test(org.junit.jupiter.api.Test) Matchers.instanceOf(org.hamcrest.Matchers.instanceOf) CountDownLatch(java.util.concurrent.CountDownLatch) List(java.util.List) Buffer(io.servicetalk.buffer.api.Buffer) Function.identity(java.util.function.Function.identity) Matchers.is(org.hamcrest.Matchers.is) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) Assertions.fail(org.junit.jupiter.api.Assertions.fail) DEFAULT_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR) Publisher(io.servicetalk.concurrent.api.Publisher) Mock(org.mockito.Mock) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Cancellable(io.servicetalk.concurrent.Cancellable) AtomicReference(java.util.concurrent.atomic.AtomicReference) Function(java.util.function.Function) Mockito.lenient(org.mockito.Mockito.lenient) Subscriber(io.servicetalk.concurrent.PublisherSource.Subscriber) ArrayList(java.util.ArrayList) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) HttpSerializers.appSerializerUtf8FixLen(io.servicetalk.http.api.HttpSerializers.appSerializerUtf8FixLen) HttpApiConversions.toStreamingHttpService(io.servicetalk.http.api.HttpApiConversions.toStreamingHttpService) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Publisher.from(io.servicetalk.concurrent.api.Publisher.from) DELIBERATE_EXCEPTION(io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION) Nullable(javax.annotation.Nullable) TRAILER(io.servicetalk.http.api.HttpHeaderNames.TRAILER) UTF_8(java.nio.charset.StandardCharsets.UTF_8) NO_CONTENT(io.servicetalk.http.api.HttpResponseStatus.NO_CONTENT) IOException(java.io.IOException) Mockito.when(org.mockito.Mockito.when) Subscription(io.servicetalk.concurrent.PublisherSource.Subscription) OK(io.servicetalk.http.api.HttpResponseStatus.OK) SourceAdapters.toSource(io.servicetalk.concurrent.api.SourceAdapters.toSource) ExecutionException(java.util.concurrent.ExecutionException) Publisher.failed(io.servicetalk.concurrent.api.Publisher.failed) HTTP_1_1(io.servicetalk.http.api.HttpProtocolVersion.HTTP_1_1) InputStream(java.io.InputStream) Buffer(io.servicetalk.buffer.api.Buffer) HttpApiConversions.toStreamingHttpService(io.servicetalk.http.api.HttpApiConversions.toStreamingHttpService) AtomicReference(java.util.concurrent.atomic.AtomicReference) CountDownLatch(java.util.concurrent.CountDownLatch) Subscription(io.servicetalk.concurrent.PublisherSource.Subscription) Test(org.junit.jupiter.api.Test)

Aggregations

Buffer (io.servicetalk.buffer.api.Buffer)246 Test (org.junit.jupiter.api.Test)121 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)83 MethodSource (org.junit.jupiter.params.provider.MethodSource)56 StreamingHttpResponse (io.servicetalk.http.api.StreamingHttpResponse)39 StreamingHttpRequest (io.servicetalk.http.api.StreamingHttpRequest)30 StreamingHttpClient (io.servicetalk.http.api.StreamingHttpClient)29 HttpHeaders (io.servicetalk.http.api.HttpHeaders)26 Nullable (javax.annotation.Nullable)24 EmbeddedChannel (io.netty.channel.embedded.EmbeddedChannel)23 List (java.util.List)23 Publisher (io.servicetalk.concurrent.api.Publisher)22 CountDownLatch (java.util.concurrent.CountDownLatch)21 AtomicReference (java.util.concurrent.atomic.AtomicReference)20 Single (io.servicetalk.concurrent.api.Single)19 CompositeBuffer (io.servicetalk.buffer.api.CompositeBuffer)18 InputStream (java.io.InputStream)18 ArrayList (java.util.ArrayList)18 BufferAllocator (io.servicetalk.buffer.api.BufferAllocator)16 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)16