Search in sources :

Example 11 with OK

use of io.servicetalk.http.api.HttpResponseStatus.OK in project servicetalk by apple.

the class BlockingStreamingToStreamingServiceTest method cancelAfterSendMetaDataPropagated.

@Test
void cancelAfterSendMetaDataPropagated() throws Exception {
    CountDownLatch cancelLatch = new CountDownLatch(1);
    CountDownLatch serviceTerminationLatch = new CountDownLatch(1);
    CountDownLatch onErrorLatch = new CountDownLatch(1);
    AtomicReference<Throwable> throwableRef = new AtomicReference<>();
    BlockingStreamingHttpService syncService = (ctx, request, response) -> {
        response.sendMetaData();
        try {
            Thread.sleep(Long.MAX_VALUE);
        } catch (Throwable t) {
            throwableRef.set(t);
            onErrorLatch.countDown();
        } finally {
            serviceTerminationLatch.countDown();
        }
    };
    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) {
            s.cancel();
            cancelLatch.countDown();
        }

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

        @Override
        public void onError(final Throwable t) {
        }

        @Override
        public void onComplete() {
        }
    });
    cancelLatch.await();
    onErrorLatch.await();
    assertThat(throwableRef.get(), instanceOf(InterruptedException.class));
    serviceTerminationLatch.await();
}
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) AtomicReference(java.util.concurrent.atomic.AtomicReference) CountDownLatch(java.util.concurrent.CountDownLatch) HttpApiConversions.toStreamingHttpService(io.servicetalk.http.api.HttpApiConversions.toStreamingHttpService) Subscription(io.servicetalk.concurrent.PublisherSource.Subscription) Test(org.junit.jupiter.api.Test)

Example 12 with OK

use of io.servicetalk.http.api.HttpResponseStatus.OK in project servicetalk by apple.

the class DefaultMultiAddressUrlHttpClientBuilderTest method internalClientsUseDifferentExecutionContextWhenConfigured.

@Test
void internalClientsUseDifferentExecutionContextWhenConfigured() throws Exception {
    HttpExecutionContext externalCtx = new HttpExecutionContextBuilder().ioExecutor(CTX.ioExecutor()).executor(CTX.executor()).bufferAllocator(PREFER_HEAP_ALLOCATOR).executionStrategy(offloadAll()).build();
    HttpExecutionContext internalCtx = new HttpExecutionContextBuilder().ioExecutor(INTERNAL_CLIENT_CTX.ioExecutor()).executor(INTERNAL_CLIENT_CTX.executor()).bufferAllocator(PREFER_DIRECT_ALLOCATOR).executionStrategy(offloadNone()).build();
    AtomicReference<HttpExecutionContext> actualInternalCtx = new AtomicReference<>();
    try (ServerContext serverContext = HttpServers.forAddress(localAddress(0)).executionStrategy(offloadNone()).listenStreamingAndAwait((ctx, request, responseFactory) -> succeeded(responseFactory.ok()));
        BlockingHttpClient blockingHttpClient = HttpClients.forMultiAddressUrl().initializer((scheme, address, builder) -> builder.executionStrategy(internalCtx.executionStrategy()).executor(internalCtx.executor()).ioExecutor(internalCtx.ioExecutor()).bufferAllocator(internalCtx.bufferAllocator()).appendClientFilter(client -> {
            actualInternalCtx.set(client.executionContext());
            return new StreamingHttpClientFilter(client) {
            };
        })).executor(externalCtx.executor()).ioExecutor(externalCtx.ioExecutor()).executionStrategy(externalCtx.executionStrategy()).bufferAllocator(externalCtx.bufferAllocator()).buildBlocking()) {
        // Check external client
        assertExecutionContext(externalCtx, blockingHttpClient.executionContext());
        // Make a request to trigger the filter execution that extracts the execution context.
        HttpResponse response = blockingHttpClient.request(blockingHttpClient.get("http://" + serverHostAndPort(serverContext)));
        assertThat(response.status(), is(OK));
        // Check internal client
        assertExecutionContext(internalCtx, actualInternalCtx.get());
    }
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) HttpHeaders(io.servicetalk.http.api.HttpHeaders) ExecutionContextExtension.cached(io.servicetalk.transport.netty.internal.ExecutionContextExtension.cached) StreamingHttpRequester(io.servicetalk.http.api.StreamingHttpRequester) ServiceDiscovererEvent(io.servicetalk.client.api.ServiceDiscovererEvent) AtomicReference(java.util.concurrent.atomic.AtomicReference) HttpRequester(io.servicetalk.http.api.HttpRequester) HttpExecutionStrategies.defaultStrategy(io.servicetalk.http.api.HttpExecutionStrategies.defaultStrategy) HttpRequest(io.servicetalk.http.api.HttpRequest) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) PREFER_HEAP_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.PREFER_HEAP_ALLOCATOR) Single.succeeded(io.servicetalk.concurrent.api.Single.succeeded) HttpExecutionStrategies.offloadNone(io.servicetalk.http.api.HttpExecutionStrategies.offloadNone) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) Matchers.contentEqualTo(io.servicetalk.buffer.api.Matchers.contentEqualTo) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HttpExecutionContext(io.servicetalk.http.api.HttpExecutionContext) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) ExecutionContextExtension.immediate(io.servicetalk.transport.netty.internal.ExecutionContextExtension.immediate) ServerContext(io.servicetalk.transport.api.ServerContext) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) HttpResponse(io.servicetalk.http.api.HttpResponse) ServiceDiscoverer(io.servicetalk.client.api.ServiceDiscoverer) ExecutionContextExtension(io.servicetalk.transport.netty.internal.ExecutionContextExtension) BlockingHttpRequester(io.servicetalk.http.api.BlockingHttpRequester) BlockingStreamingHttpRequester(io.servicetalk.http.api.BlockingStreamingHttpRequester) StreamingHttpClientFilter(io.servicetalk.http.api.StreamingHttpClientFilter) OK(io.servicetalk.http.api.HttpResponseStatus.OK) InetSocketAddress(java.net.InetSocketAddress) Mockito.verify(org.mockito.Mockito.verify) DefaultHttpHeadersFactory(io.servicetalk.http.api.DefaultHttpHeadersFactory) Test(org.junit.jupiter.api.Test) PREFER_DIRECT_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.PREFER_DIRECT_ALLOCATOR) Mockito.never(org.mockito.Mockito.never) HttpExecutionStrategies.offloadAll(io.servicetalk.http.api.HttpExecutionStrategies.offloadAll) Matchers.sameInstance(org.hamcrest.Matchers.sameInstance) Matchers.is(org.hamcrest.Matchers.is) HttpHeadersFactory(io.servicetalk.http.api.HttpHeadersFactory) HostAndPort(io.servicetalk.transport.api.HostAndPort) Mockito.mock(org.mockito.Mockito.mock) StreamingHttpClientFilter(io.servicetalk.http.api.StreamingHttpClientFilter) ServerContext(io.servicetalk.transport.api.ServerContext) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) HttpExecutionContext(io.servicetalk.http.api.HttpExecutionContext) HttpResponse(io.servicetalk.http.api.HttpResponse) AtomicReference(java.util.concurrent.atomic.AtomicReference) Test(org.junit.jupiter.api.Test)

Example 13 with OK

use of io.servicetalk.http.api.HttpResponseStatus.OK in project servicetalk by apple.

the class ConsumeRequestPayloadOnResponsePathTest method test.

private void test(final BiFunction<Single<StreamingHttpResponse>, StreamingHttpRequest, Single<StreamingHttpResponse>> consumeRequestPayload) throws Exception {
    try (ServerContext serverContext = HttpServers.forAddress(localAddress(0)).appendServiceFilter(service -> new StreamingHttpServiceFilter(service) {

        @Override
        public Single<StreamingHttpResponse> handle(final HttpServiceContext ctx, final StreamingHttpRequest request, final StreamingHttpResponseFactory responseFactory) {
            return consumeRequestPayload.apply(delegate().handle(ctx, request, responseFactory), request);
        }
    }).listenStreamingAndAwait((ctx, request, responseFactory) -> {
        final StreamingHttpResponse response = responseFactory.ok().addHeader(TRAILER, X_TOTAL_LENGTH).payloadBody(from("Response\n", "Payload\n", "Body\n"), appSerializerUtf8FixLen()).transform(new TrailersTransformer<AtomicInteger, Buffer>() {

            @Override
            public AtomicInteger newState() {
                return new AtomicInteger();
            }

            @Override
            public Buffer accept(final AtomicInteger total, final Buffer chunk) {
                total.addAndGet(chunk.readableBytes());
                return chunk;
            }

            @Override
            public HttpHeaders payloadComplete(final AtomicInteger total, final HttpHeaders trailers) {
                trailers.add(X_TOTAL_LENGTH, String.valueOf(total.get()));
                return trailers;
            }

            @Override
            public HttpHeaders catchPayloadFailure(final AtomicInteger __, final Throwable ___, final HttpHeaders trailers) {
                return trailers;
            }
        });
        return succeeded(response);
    })) {
        HttpResponse response;
        try (BlockingHttpClient client = HttpClients.forSingleAddress(AddressUtils.serverHostAndPort(serverContext)).buildBlocking()) {
            response = client.request(client.post("/").payloadBody(EXPECTED_REQUEST_PAYLOAD, textSerializerUtf8()));
            serverLatch.await();
        }
        assertThat(response.status(), is(OK));
        assertThat("Request payload body might be consumed by someone else", errorRef.get(), is(nullValue()));
        assertThat(receivedPayload.toString(), is(EXPECTED_REQUEST_PAYLOAD));
        assertThat(response.headers().contains(TRAILER, X_TOTAL_LENGTH), is(true));
        assertThat(response.trailers().contains(X_TOTAL_LENGTH), is(true));
        CharSequence trailerLength = response.trailers().get(X_TOTAL_LENGTH);
        assertNotNull(trailerLength);
        assertThat("Unexpected response payload: '" + response.payloadBody().toString(UTF_8) + "'", trailerLength.toString(), is(Integer.toString(response.payloadBody().readableBytes())));
    }
}
Also used : Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) DEFAULT_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR) TrailersTransformer(io.servicetalk.http.api.TrailersTransformer) BiFunction(java.util.function.BiFunction) HttpHeaders(io.servicetalk.http.api.HttpHeaders) StreamingHttpResponses.newTransportResponse(io.servicetalk.http.api.StreamingHttpResponses.newTransportResponse) PlatformDependent(io.servicetalk.utils.internal.PlatformDependent) AtomicReference(java.util.concurrent.atomic.AtomicReference) StreamingHttpServiceFilter(io.servicetalk.http.api.StreamingHttpServiceFilter) HttpServiceContext(io.servicetalk.http.api.HttpServiceContext) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) Single.succeeded(io.servicetalk.concurrent.api.Single.succeeded) HttpSerializers.appSerializerUtf8FixLen(io.servicetalk.http.api.HttpSerializers.appSerializerUtf8FixLen) HttpSerializers.textSerializerUtf8(io.servicetalk.http.api.HttpSerializers.textSerializerUtf8) Matchers.nullValue(org.hamcrest.Matchers.nullValue) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Publisher.from(io.servicetalk.concurrent.api.Publisher.from) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) ServerContext(io.servicetalk.transport.api.ServerContext) TRAILER(io.servicetalk.http.api.HttpHeaderNames.TRAILER) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Single(io.servicetalk.concurrent.api.Single) Completable(io.servicetalk.concurrent.api.Completable) HttpResponse(io.servicetalk.http.api.HttpResponse) OK(io.servicetalk.http.api.HttpResponseStatus.OK) DefaultHttpHeadersFactory(io.servicetalk.http.api.DefaultHttpHeadersFactory) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) Buffer(io.servicetalk.buffer.api.Buffer) StreamingHttpResponseFactory(io.servicetalk.http.api.StreamingHttpResponseFactory) Matchers.is(org.hamcrest.Matchers.is) AddressUtils(io.servicetalk.transport.netty.internal.AddressUtils) Buffer(io.servicetalk.buffer.api.Buffer) HttpHeaders(io.servicetalk.http.api.HttpHeaders) BlockingHttpClient(io.servicetalk.http.api.BlockingHttpClient) StreamingHttpResponseFactory(io.servicetalk.http.api.StreamingHttpResponseFactory) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) HttpResponse(io.servicetalk.http.api.HttpResponse) StreamingHttpServiceFilter(io.servicetalk.http.api.StreamingHttpServiceFilter) ServerContext(io.servicetalk.transport.api.ServerContext) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) HttpServiceContext(io.servicetalk.http.api.HttpServiceContext) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse)

Example 14 with OK

use of io.servicetalk.http.api.HttpResponseStatus.OK in project servicetalk by apple.

the class AbstractEchoServerBasedHttpRequesterTest method makeRequestValidateResponseAndClose.

static void makeRequestValidateResponseAndClose(StreamingHttpRequester requester) throws ExecutionException, InterruptedException {
    try {
        StreamingHttpRequest request = requester.get("/request?foo=bar&foo=baz").payloadBody(from(DEFAULT_ALLOCATOR.fromAscii("Testing123")));
        request.headers().set(HOST, "mock.servicetalk.io");
        StreamingHttpResponse resp = awaitIndefinitelyNonNull(requester.request(request).retryWhen(retryWithExponentialBackoffFullJitter(10, t -> true, ofMillis(100), ofDays(10), CTX.executor())));
        assertThat(resp.status(), equalTo(OK));
        Single<String> respBody = resp.payloadBody().collect(StringBuilder::new, (sb, buf) -> {
            sb.append(buf.toString(UTF_8));
            return sb;
        }).map(StringBuilder::toString);
        HttpHeaders headers = resp.headers();
        assertThat(headers.get("test-req-method"), hasToString(GET.toString()));
        assertThat(headers.get("test-req-target"), hasToString("/request?foo=bar&foo=baz"));
        assertThat(headers.get("test-req-header-host"), hasToString("mock.servicetalk.io"));
        assertThat(headers.get("test-req-header-transfer-encoding"), equalTo(CHUNKED));
        assertThat(respBody.toFuture().get(), equalTo("Testing123"));
    } finally {
        requester.closeAsync().toFuture().get();
    }
}
Also used : Matchers.hasToString(org.hamcrest.Matchers.hasToString) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) DEFAULT_ALLOCATOR(io.servicetalk.buffer.netty.BufferAllocators.DEFAULT_ALLOCATOR) IsEqual.equalTo(org.hamcrest.core.IsEqual.equalTo) HttpHeaders(io.servicetalk.http.api.HttpHeaders) StreamingHttpRequester(io.servicetalk.http.api.StreamingHttpRequester) HttpServers.forAddress(io.servicetalk.http.netty.HttpServers.forAddress) AfterAll(org.junit.jupiter.api.AfterAll) HttpServiceContext(io.servicetalk.http.api.HttpServiceContext) TestInstance(org.junit.jupiter.api.TestInstance) BeforeAll(org.junit.jupiter.api.BeforeAll) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) Single.succeeded(io.servicetalk.concurrent.api.Single.succeeded) HOST(io.servicetalk.http.api.HttpHeaderNames.HOST) BlockingTestUtils.awaitIndefinitelyNonNull(io.servicetalk.concurrent.api.BlockingTestUtils.awaitIndefinitelyNonNull) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) HttpExecutionStrategies.offloadNone(io.servicetalk.http.api.HttpExecutionStrategies.offloadNone) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Publisher.from(io.servicetalk.concurrent.api.Publisher.from) CHUNKED(io.servicetalk.http.api.HttpHeaderValues.CHUNKED) Duration.ofDays(java.time.Duration.ofDays) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) ServerContext(io.servicetalk.transport.api.ServerContext) RetryStrategies.retryWithExponentialBackoffFullJitter(io.servicetalk.concurrent.api.RetryStrategies.retryWithExponentialBackoffFullJitter) UTF_8(java.nio.charset.StandardCharsets.UTF_8) Single(io.servicetalk.concurrent.api.Single) ExecutionContextExtension(io.servicetalk.transport.netty.internal.ExecutionContextExtension) OK(io.servicetalk.http.api.HttpResponseStatus.OK) GET(io.servicetalk.http.api.HttpRequestMethod.GET) ExecutionException(java.util.concurrent.ExecutionException) StreamingHttpService(io.servicetalk.http.api.StreamingHttpService) StreamingHttpResponseFactory(io.servicetalk.http.api.StreamingHttpResponseFactory) Duration.ofMillis(java.time.Duration.ofMillis) HttpHeaders(io.servicetalk.http.api.HttpHeaders) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) Matchers.hasToString(org.hamcrest.Matchers.hasToString) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse)

Example 15 with OK

use of io.servicetalk.http.api.HttpResponseStatus.OK in project servicetalk by apple.

the class RedirectingClientAndConnectionFilterTest method redirectFilterWithHostHeaderAbsoluteLocation.

@ParameterizedTest(name = "{displayName} [{index}] {0}-{1}")
@MethodSource("requesterTypes")
void redirectFilterWithHostHeaderAbsoluteLocation(final RequesterType type, final SecurityType security) throws Exception {
    setUp(security);
    BlockingHttpRequester client = asBlockingRequester(createFilter(type, (responseFactory, request) -> {
        if (request.requestTarget().equals("/")) {
            return succeeded(responseFactory.permanentRedirect().addHeader(LOCATION, "http://servicetalk.io:80/next"));
        }
        return succeeded(responseFactory.ok());
    }, newFilterFactory()));
    HttpRequest request = client.get("/").addHeader(HOST, "servicetalk.io:80");
    HttpResponse response = client.request(request);
    assertThat(response.status(), equalTo(PERMANENT_REDIRECT));
    response = client.request(request.addHeader("X-REDIRECT", "TRUE"));
    assertThat(response.status(), equalTo(OK));
}
Also used : HttpConnection(io.servicetalk.http.api.HttpConnection) HttpResponse(io.servicetalk.http.api.HttpResponse) LOCATION(io.servicetalk.http.api.HttpHeaderNames.LOCATION) BlockingHttpRequester(io.servicetalk.http.api.BlockingHttpRequester) OK(io.servicetalk.http.api.HttpResponseStatus.OK) RedirectingHttpRequesterFilter(io.servicetalk.http.utils.RedirectingHttpRequesterFilter) String.format(java.lang.String.format) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) FilterFactory(io.servicetalk.http.netty.ConditionalFilterFactory.FilterFactory) HttpRequest(io.servicetalk.http.api.HttpRequest) Single.succeeded(io.servicetalk.concurrent.api.Single.succeeded) HOST(io.servicetalk.http.api.HttpHeaderNames.HOST) PERMANENT_REDIRECT(io.servicetalk.http.api.HttpResponseStatus.PERMANENT_REDIRECT) AddressUtils.hostHeader(io.servicetalk.transport.netty.internal.AddressUtils.hostHeader) Matchers.equalTo(org.hamcrest.Matchers.equalTo) HttpClient(io.servicetalk.http.api.HttpClient) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) HostHeaderHttpRequesterFilter(io.servicetalk.http.utils.HostHeaderHttpRequesterFilter) AbstractHttpRequesterFilterTest(io.servicetalk.http.api.AbstractHttpRequesterFilterTest) HostAndPort(io.servicetalk.transport.api.HostAndPort) MethodSource(org.junit.jupiter.params.provider.MethodSource) HTTP_1_0(io.servicetalk.http.api.HttpProtocolVersion.HTTP_1_0) HttpRequest(io.servicetalk.http.api.HttpRequest) HttpResponse(io.servicetalk.http.api.HttpResponse) BlockingHttpRequester(io.servicetalk.http.api.BlockingHttpRequester) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest) MethodSource(org.junit.jupiter.params.provider.MethodSource)

Aggregations

OK (io.servicetalk.http.api.HttpResponseStatus.OK)21 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)17 HttpResponse (io.servicetalk.http.api.HttpResponse)13 Single.succeeded (io.servicetalk.concurrent.api.Single.succeeded)12 ServerContext (io.servicetalk.transport.api.ServerContext)12 AddressUtils.localAddress (io.servicetalk.transport.netty.internal.AddressUtils.localAddress)12 Test (org.junit.jupiter.api.Test)11 Single (io.servicetalk.concurrent.api.Single)10 HostAndPort (io.servicetalk.transport.api.HostAndPort)10 AddressUtils.serverHostAndPort (io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort)10 Matchers.is (org.hamcrest.Matchers.is)10 HttpRequest (io.servicetalk.http.api.HttpRequest)8 StreamingHttpResponse (io.servicetalk.http.api.StreamingHttpResponse)8 BlockingHttpClient (io.servicetalk.http.api.BlockingHttpClient)7 HttpExecutionStrategies.offloadNone (io.servicetalk.http.api.HttpExecutionStrategies.offloadNone)7 StreamingHttpRequest (io.servicetalk.http.api.StreamingHttpRequest)7 AtomicReference (java.util.concurrent.atomic.AtomicReference)7 Nullable (javax.annotation.Nullable)7 RegisterExtension (org.junit.jupiter.api.extension.RegisterExtension)7 ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)7