Search in sources :

Example 6 with HostAndPort

use of io.servicetalk.transport.api.HostAndPort in project servicetalk by apple.

the class DefaultDnsClient method dnsSrvQuery.

@Override
public Publisher<Collection<ServiceDiscovererEvent<InetSocketAddress>>> dnsSrvQuery(final String serviceName) {
    requireNonNull(serviceName);
    return defer(() -> {
        // State per subscribe requires defer so each subscribe gets independent state.
        final Map<String, ARecordPublisher> aRecordMap = new HashMap<>(8);
        final Map<InetSocketAddress, Integer> availableAddresses = srvFilterDuplicateEvents ? new HashMap<>(8) : emptyMap();
        final DnsDiscoveryObserver discoveryObserver = newDiscoveryObserver(serviceName);
        // inactive events if necessary.
        return recoverWithInactiveEvents(new SrvRecordPublisher(serviceName, discoveryObserver), true).flatMapConcatIterable(identity()).flatMapMerge(srvEvent -> {
            assertInEventloop();
            if (AVAILABLE.equals(srvEvent.status())) {
                return defer(() -> {
                    final ARecordPublisher aPublisher = new ARecordPublisher(srvEvent.address().hostName(), discoveryObserver);
                    final ARecordPublisher prevAPublisher = aRecordMap.putIfAbsent(srvEvent.address().hostName(), aPublisher);
                    if (prevAPublisher != null) {
                        return newDuplicateSrv(serviceName, srvEvent.address().hostName());
                    }
                    Publisher<? extends Collection<ServiceDiscovererEvent<InetAddress>>> returnPub = recoverWithInactiveEvents(aPublisher, false);
                    return srvFilterDuplicateEvents ? srvFilterDups(returnPub, availableAddresses, srvEvent.address().port()) : returnPub.map(events -> mapEventList(events, inetAddress -> new InetSocketAddress(inetAddress, srvEvent.address().port())));
                }).retryWhen((i, cause) -> {
                    assertInEventloop();
                    // don't retry. Otherwise this is a resolution exception (e.g. UnknownHostException), and retry.
                    return cause == SrvAddressRemovedException.DNS_SRV_ADDR_REMOVED || aRecordMap.remove(srvEvent.address().hostName()) == null ? Completable.failed(cause) : srvHostNameRepeater.apply(i);
                }).onErrorComplete();
            } else if (srvEvent instanceof SrvInactiveEvent) {
                // Unwrap the list so we can use it in SrvInactiveCombinerOperator below.
                return from(((SrvInactiveEvent<HostAndPort, InetSocketAddress>) srvEvent).aggregatedEvents);
            } else {
                final ARecordPublisher aPublisher = aRecordMap.remove(srvEvent.address().hostName());
                if (aPublisher != null) {
                    aPublisher.cancelAndFail0(SrvAddressRemovedException.DNS_SRV_ADDR_REMOVED);
                }
                return empty();
            }
        }, srvConcurrency).liftSync(inactiveEventsOnError ? SrvInactiveCombinerOperator.EMIT : SrvInactiveCombinerOperator.NO_EMIT);
    });
}
Also used : EventLoopAwareNettyIoExecutor(io.servicetalk.transport.netty.internal.EventLoopAwareNettyIoExecutor) CancelImmediatelySubscriber(io.servicetalk.concurrent.internal.CancelImmediatelySubscriber) LoggerFactory(org.slf4j.LoggerFactory) ServiceDiscovererEvent(io.servicetalk.client.api.ServiceDiscovererEvent) Publisher.empty(io.servicetalk.concurrent.api.Publisher.empty) DefaultDnsQuestion(io.netty.handler.codec.dns.DefaultDnsQuestion) DefaultDnsCache(io.netty.resolver.dns.DefaultDnsCache) Collections.singletonList(java.util.Collections.singletonList) InetAddress(java.net.InetAddress) SubscriberUtils.newExceptionForInvalidRequestN(io.servicetalk.concurrent.internal.SubscriberUtils.newExceptionForInvalidRequestN) Duration(java.time.Duration) Map(java.util.Map) DnsClients.mapEventList(io.servicetalk.dns.discovery.netty.DnsClients.mapEventList) BuilderUtils.socketChannel(io.servicetalk.transport.netty.internal.BuilderUtils.socketChannel) SocketChannel(io.netty.channel.socket.SocketChannel) DnsDiscoveryObserver(io.servicetalk.dns.discovery.netty.DnsServiceDiscovererObserver.DnsDiscoveryObserver) DefaultDnsRecordDecoder.decodeName(io.netty.handler.codec.dns.DefaultDnsRecordDecoder.decodeName) DnsNameResolver(io.netty.resolver.dns.DnsNameResolver) FutureListener(io.netty.util.concurrent.FutureListener) SubscriberUtils.handleExceptionFromOnSubscribe(io.servicetalk.concurrent.internal.SubscriberUtils.handleExceptionFromOnSubscribe) Collections.emptyList(java.util.Collections.emptyList) Collection(java.util.Collection) ThrowableUtils.unknownStackTrace(io.servicetalk.concurrent.internal.ThrowableUtils.unknownStackTrace) DefaultServiceDiscovererEvent(io.servicetalk.client.api.DefaultServiceDiscovererEvent) EventLoop(io.netty.channel.EventLoop) InetSocketAddress(java.net.InetSocketAddress) List(java.util.List) ReferenceCountUtil(io.netty.util.ReferenceCountUtil) DuplicateSubscribeException(io.servicetalk.concurrent.internal.DuplicateSubscribeException) Function.identity(java.util.function.Function.identity) ResolutionResult(io.servicetalk.dns.discovery.netty.DnsServiceDiscovererObserver.ResolutionResult) DnsRecord(io.netty.handler.codec.dns.DnsRecord) DnsNameResolverBuilder(io.netty.resolver.dns.DnsNameResolverBuilder) Publisher(io.servicetalk.concurrent.api.Publisher) NANOSECONDS(java.util.concurrent.TimeUnit.NANOSECONDS) ByteBuffer.wrap(java.nio.ByteBuffer.wrap) DnsRawRecord(io.netty.handler.codec.dns.DnsRawRecord) HashMap(java.util.HashMap) Cancellable(io.servicetalk.concurrent.Cancellable) DnsResolutionObserver(io.servicetalk.dns.discovery.netty.DnsServiceDiscovererObserver.DnsResolutionObserver) RepeatStrategies.repeatWithConstantBackoffDeltaJitter(io.servicetalk.concurrent.api.RepeatStrategies.repeatWithConstantBackoffDeltaJitter) Subscriber(io.servicetalk.concurrent.PublisherSource.Subscriber) ArrayList(java.util.ArrayList) RandomAccess(java.util.RandomAccess) BuilderUtils.datagramChannel(io.servicetalk.transport.netty.internal.BuilderUtils.datagramChannel) SubscribablePublisher(io.servicetalk.concurrent.api.internal.SubscribablePublisher) AVAILABLE(io.servicetalk.client.api.ServiceDiscovererEvent.Status.AVAILABLE) ByteBuf(io.netty.buffer.ByteBuf) ImmediateEventExecutor(io.netty.util.concurrent.ImmediateEventExecutor) SubscriberUtils.deliverErrorFromSource(io.servicetalk.concurrent.internal.SubscriberUtils.deliverErrorFromSource) ServiceDiscovererUtils.calculateDifference(io.servicetalk.dns.discovery.netty.ServiceDiscovererUtils.calculateDifference) SRV(io.netty.handler.codec.dns.DnsRecordType.SRV) Objects.requireNonNull(java.util.Objects.requireNonNull) Comparator.comparing(java.util.Comparator.comparing) Publisher.from(io.servicetalk.concurrent.api.Publisher.from) Publisher.defer(io.servicetalk.concurrent.api.Publisher.defer) SubscriberUtils.safeOnError(io.servicetalk.concurrent.internal.SubscriberUtils.safeOnError) Nullable(javax.annotation.Nullable) IntFunction(java.util.function.IntFunction) Collections.emptyMap(java.util.Collections.emptyMap) Logger(org.slf4j.Logger) SubscriberUtils.isRequestNValid(io.servicetalk.concurrent.internal.SubscriberUtils.isRequestNValid) Promise(io.netty.util.concurrent.Promise) EventLoopAwareNettyIoExecutors.toEventLoopAwareNettyIoExecutor(io.servicetalk.transport.netty.internal.EventLoopAwareNettyIoExecutors.toEventLoopAwareNettyIoExecutor) ListenableAsyncCloseable(io.servicetalk.concurrent.api.ListenableAsyncCloseable) ClosedChannelException(java.nio.channels.ClosedChannelException) FlowControlUtils.addWithOverflowProtection(io.servicetalk.concurrent.internal.FlowControlUtils.addWithOverflowProtection) Completable(io.servicetalk.concurrent.api.Completable) PublisherOperator(io.servicetalk.concurrent.api.PublisherOperator) AsyncCloseables.toAsyncCloseable(io.servicetalk.concurrent.api.AsyncCloseables.toAsyncCloseable) Subscription(io.servicetalk.concurrent.PublisherSource.Subscription) RejectedSubscribeError(io.servicetalk.concurrent.internal.RejectedSubscribeError) IoExecutor(io.servicetalk.transport.api.IoExecutor) Publisher.failed(io.servicetalk.concurrent.api.Publisher.failed) Completable.completed(io.servicetalk.concurrent.api.Completable.completed) ResolvedAddressTypes(io.netty.resolver.ResolvedAddressTypes) Future(io.netty.util.concurrent.Future) Comparator(java.util.Comparator) SECONDS(java.util.concurrent.TimeUnit.SECONDS) HostAndPort(io.servicetalk.transport.api.HostAndPort) DnsDiscoveryObserver(io.servicetalk.dns.discovery.netty.DnsServiceDiscovererObserver.DnsDiscoveryObserver) HashMap(java.util.HashMap) InetSocketAddress(java.net.InetSocketAddress) Publisher(io.servicetalk.concurrent.api.Publisher) SubscribablePublisher(io.servicetalk.concurrent.api.internal.SubscribablePublisher) HostAndPort(io.servicetalk.transport.api.HostAndPort) Collection(java.util.Collection) InetAddress(java.net.InetAddress)

Example 7 with HostAndPort

use of io.servicetalk.transport.api.HostAndPort in project servicetalk by apple.

the class TrailersOnlyErrorTest method testServiceThrows.

@Test
void testServiceThrows() throws Exception {
    final BlockingQueue<Throwable> asyncErrors = new LinkedBlockingDeque<>();
    final TesterService service = mockTesterService();
    setupServiceThrows(service);
    try (ServerContext serverContext = GrpcServers.forAddress(localAddress(0)).listenAndAwait(new Tester.ServiceFactory(service))) {
        final GrpcClientBuilder<HostAndPort, InetSocketAddress> clientBuilder = GrpcClients.forAddress(serverHostAndPort(serverContext)).initializeHttp(builder -> builder.appendClientFilter(__ -> true, setupResponseVerifierFilter(asyncErrors)));
        try (TesterClient client = clientBuilder.build(new Tester.ClientFactory())) {
            verifyException(client.test(TestRequest.newBuilder().build()).toFuture(), UNKNOWN);
            assertNoAsyncErrors(asyncErrors);
            verifyException(client.testRequestStream(Publisher.from(TestRequest.newBuilder().build())).toFuture(), UNKNOWN);
            assertNoAsyncErrors(asyncErrors);
            verifyException(client.testBiDiStream(from(TestRequest.newBuilder().build()).concat(never())).toFuture(), UNKNOWN);
            assertNoAsyncErrors(asyncErrors);
            verifyException(client.testBiDiStream(from(TestRequest.newBuilder().build())).toFuture(), UNKNOWN);
            assertNoAsyncErrors(asyncErrors);
        }
    }
}
Also used : TestUtils.assertNoAsyncErrors(io.servicetalk.test.resources.TestUtils.assertNoAsyncErrors) FilterableStreamingHttpClient(io.servicetalk.http.api.FilterableStreamingHttpClient) UNKNOWN(io.servicetalk.grpc.api.GrpcStatusCode.UNKNOWN) GrpcStatusCode(io.servicetalk.grpc.api.GrpcStatusCode) HelloRequest(io.grpc.examples.helloworld.HelloRequest) HttpResponseMetaData(io.servicetalk.http.api.HttpResponseMetaData) GreeterClient(io.grpc.examples.helloworld.Greeter.GreeterClient) GrpcStatusException(io.servicetalk.grpc.api.GrpcStatusException) Future(java.util.concurrent.Future) UNIMPLEMENTED(io.servicetalk.grpc.api.GrpcStatusCode.UNIMPLEMENTED) TesterClient(io.servicetalk.grpc.netty.TesterProto.Tester.TesterClient) Greeter(io.grpc.examples.helloworld.Greeter) Matchers.notNullValue(org.hamcrest.Matchers.notNullValue) BlockingQueue(java.util.concurrent.BlockingQueue) StreamingHttpClientFilter(io.servicetalk.http.api.StreamingHttpClientFilter) InetSocketAddress(java.net.InetSocketAddress) Test(org.junit.jupiter.api.Test) Matchers.equalTo(org.hamcrest.Matchers.equalTo) GrpcClientBuilder(io.servicetalk.grpc.api.GrpcClientBuilder) Mockito.mock(org.mockito.Mockito.mock) Publisher.never(io.servicetalk.concurrent.api.Publisher.never) Assertions.assertThrows(org.junit.jupiter.api.Assertions.assertThrows) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) Assertions.assertNotNull(org.junit.jupiter.api.Assertions.assertNotNull) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) Publisher(io.servicetalk.concurrent.api.Publisher) StreamingHttpRequester(io.servicetalk.http.api.StreamingHttpRequester) StreamingHttpServiceFilter(io.servicetalk.http.api.StreamingHttpServiceFilter) HttpServiceContext(io.servicetalk.http.api.HttpServiceContext) GrpcServerBuilder(io.servicetalk.grpc.api.GrpcServerBuilder) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) Publisher.from(io.servicetalk.concurrent.api.Publisher.from) DELIBERATE_EXCEPTION(io.servicetalk.concurrent.internal.DeliberateException.DELIBERATE_EXCEPTION) AddressUtils.localAddress(io.servicetalk.transport.netty.internal.AddressUtils.localAddress) ServerContext(io.servicetalk.transport.api.ServerContext) Single(io.servicetalk.concurrent.api.Single) TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) TestRequest(io.servicetalk.grpc.netty.TesterProto.TestRequest) Mockito.when(org.mockito.Mockito.when) ExecutionException(java.util.concurrent.ExecutionException) GRPC_STATUS(io.servicetalk.grpc.api.GrpcHeaderNames.GRPC_STATUS) Completable.completed(io.servicetalk.concurrent.api.Completable.completed) StreamingHttpResponseFactory(io.servicetalk.http.api.StreamingHttpResponseFactory) LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) StreamingHttpClientFilterFactory(io.servicetalk.http.api.StreamingHttpClientFilterFactory) Tester(io.servicetalk.grpc.netty.TesterProto.Tester) HostAndPort(io.servicetalk.transport.api.HostAndPort) LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) Tester(io.servicetalk.grpc.netty.TesterProto.Tester) InetSocketAddress(java.net.InetSocketAddress) TesterService(io.servicetalk.grpc.netty.TesterProto.Tester.TesterService) AddressUtils.serverHostAndPort(io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort) HostAndPort(io.servicetalk.transport.api.HostAndPort) TesterClient(io.servicetalk.grpc.netty.TesterProto.Tester.TesterClient) ServerContext(io.servicetalk.transport.api.ServerContext) Test(org.junit.jupiter.api.Test)

Example 8 with HostAndPort

use of io.servicetalk.transport.api.HostAndPort in project servicetalk by apple.

the class HttpRequestUriUtils method buildEffectiveRequestUri.

private static String buildEffectiveRequestUri(@Nullable final ConnectionContext ctx, final HttpRequestMetaData metaData, @Nullable final String fixedScheme, @Nullable final String fixedAuthority, @Nullable String path, @Nullable String query, final boolean includeUserInfo, final boolean checkAuthorityOrAsteriskForm) {
    if (fixedScheme != null && !"http".equalsIgnoreCase(fixedScheme) && !"https".equalsIgnoreCase(fixedScheme)) {
        throw new IllegalArgumentException("Unsupported scheme: " + fixedScheme);
    }
    if (ctx == null && (fixedScheme == null || fixedAuthority == null)) {
        throw new IllegalArgumentException("Context required without scheme and authority");
    }
    // path and query component is empty.
    if (checkAuthorityOrAsteriskForm && (CONNECT.equals(metaData.method()) || OPTIONS.equals(metaData.method()))) {
        path = query = null;
    }
    final String metadataScheme = metaData.scheme();
    if (metadataScheme != null) {
        // absolute form
        return buildRequestUri(metadataScheme, includeUserInfo ? metaData.userInfo() : null, metaData.host(), metaData.port(), path, query);
    }
    final String scheme = fixedScheme != null ? fixedScheme.toLowerCase() : (ctx.sslSession() != null ? "https" : "http");
    final HostAndPort effectiveHostAndPort;
    if (fixedAuthority != null) {
        return buildRequestUri(scheme, fixedAuthority, path, query);
    } else if ((effectiveHostAndPort = metaData.effectiveHostAndPort()) != null) {
        return buildRequestUri(scheme, includeUserInfo ? metaData.userInfo() : null, effectiveHostAndPort.hostName(), effectiveHostAndPort.port(), path, query);
    } else {
        if (!(ctx.localAddress() instanceof InetSocketAddress)) {
            throw new IllegalArgumentException("ConnectionContext#getLocalAddress is not an InetSocketAddress: " + ctx.localAddress());
        }
        final InetSocketAddress localAddress = (InetSocketAddress) ctx.localAddress();
        final boolean defaultPort = ("http".equals(scheme) && localAddress.getPort() == 80) || ("https".equals(scheme) && localAddress.getPort() == 443);
        return buildRequestUri(scheme, null, localAddress.getHostName(), defaultPort ? -1 : localAddress.getPort(), path, query);
    }
}
Also used : HostAndPort(io.servicetalk.transport.api.HostAndPort) InetSocketAddress(java.net.InetSocketAddress)

Example 9 with HostAndPort

use of io.servicetalk.transport.api.HostAndPort in project servicetalk by apple.

the class DefaultMultiAddressUrlHttpClientBuilder method buildStreaming.

@Override
public StreamingHttpClient buildStreaming() {
    final CompositeCloseable closeables = newCompositeCloseable();
    try {
        final HttpClientBuildContext<HostAndPort, InetSocketAddress> buildContext = builderTemplate.copyBuildCtx();
        final ClientFactory clientFactory = new ClientFactory(buildContext.builder, singleAddressInitializer);
        HttpExecutionContext executionContext = buildContext.builder.executionContextBuilder.build();
        final CachingKeyFactory keyFactory = closeables.prepend(new CachingKeyFactory());
        FilterableStreamingHttpClient urlClient = closeables.prepend(new StreamingUrlHttpClient(executionContext, clientFactory, keyFactory, defaultReqRespFactory(buildContext.httpConfig().asReadOnly(), executionContext.bufferAllocator())));
        // Need to wrap the top level client (group) in order for non-relative redirects to work
        urlClient = redirectConfig == null ? urlClient : new RedirectingHttpRequesterFilter(redirectConfig).create(urlClient);
        HttpExecutionStrategy computedStrategy = buildContext.builder.computeChainStrategy(executionContext.executionStrategy());
        LOGGER.debug("Client created with base strategy {} → computed strategy {}", executionContext.executionStrategy(), computedStrategy);
        return new FilterableClientToClient(urlClient, computedStrategy);
    } catch (final Throwable t) {
        closeables.closeAsync().subscribe();
        throw t;
    }
}
Also used : InetSocketAddress(java.net.InetSocketAddress) CompositeCloseable(io.servicetalk.concurrent.api.CompositeCloseable) AsyncCloseables.newCompositeCloseable(io.servicetalk.concurrent.api.AsyncCloseables.newCompositeCloseable) HostAndPort(io.servicetalk.transport.api.HostAndPort) HttpExecutionContext(io.servicetalk.http.api.HttpExecutionContext) FilterableStreamingHttpClient(io.servicetalk.http.api.FilterableStreamingHttpClient) HttpExecutionStrategy(io.servicetalk.http.api.HttpExecutionStrategy) RedirectingHttpRequesterFilter(io.servicetalk.http.utils.RedirectingHttpRequesterFilter)

Example 10 with HostAndPort

use of io.servicetalk.transport.api.HostAndPort in project servicetalk by apple.

the class H2ConcurrencyControllerTest method setUp.

@BeforeEach
void setUp() throws Exception {
    serverEventLoopGroup = createIoExecutor(1, "server-io").eventLoopGroup();
    for (int i = 0; i < N_ITERATIONS; i++) {
        latches[i] = new CountDownLatch(1);
    }
    AtomicBoolean secondAndMore = new AtomicBoolean();
    serverAcceptorChannel = bindH2Server(serverEventLoopGroup, new ChannelInitializer<Http2StreamChannel>() {

        @Override
        protected void initChannel(Http2StreamChannel ch) {
            // Respond only for the first request which is used to propagate MAX_CONCURRENT_STREAMS_VALUE
            if (secondAndMore.compareAndSet(false, true)) {
                ch.pipeline().addLast(new EchoHttp2Handler());
            } else {
                // Do not respond to any subsequent requests, only release the associated latch to notify the client
                // that server received the request.
                ch.pipeline().addLast(new SimpleChannelInboundHandler<Http2HeadersFrame>() {

                    @Override
                    protected void channelRead0(final ChannelHandlerContext ctx, final Http2HeadersFrame msg) {
                        String path = msg.headers().path().toString();
                        int i = parseInt(path.substring(1));
                        latches[i].countDown();
                    }
                });
            }
        }
    }, parentPipeline -> {
    }, h2Builder -> {
        h2Builder.initialSettings().maxConcurrentStreams(MAX_CONCURRENT_STREAMS_VALUE);
        return h2Builder;
    });
    final HostAndPort serverAddress = of((InetSocketAddress) serverAcceptorChannel.localAddress());
    client = forResolvedAddress(serverAddress).ioExecutor(CTX.ioExecutor()).executor(CTX.executor()).executionStrategy(defaultStrategy()).appendClientFilter(// All exceptions should be propagated
    disableAutoRetries()).appendConnectionFilter(MulticastTransportEventsStreamingHttpConnectionFilter::new).appendConnectionFilter(connection -> new StreamingHttpConnectionFilter(connection) {

        @Override
        public Single<StreamingHttpResponse> request(StreamingHttpRequest request) {
            return delegate().request(request).liftSync(subscriber -> new SingleSource.Subscriber<StreamingHttpResponse>() {

                @Override
                public void onSubscribe(final Cancellable cancellable) {
                    // Defer the cancel() signal to let the test thread start a new request
                    subscriber.onSubscribe(() -> CTX.executor().schedule(cancellable::cancel, ofMillis(100)));
                }

                @Override
                public void onSuccess(@Nullable final StreamingHttpResponse result) {
                    subscriber.onSuccess(result);
                }

                @Override
                public void onError(final Throwable t) {
                    subscriber.onError(t);
                }
            });
        }
    }).protocols(h2().enableFrameLogging("servicetalk-tests-h2-frame-logger", TRACE, () -> true).build()).build();
}
Also used : BeforeEach(org.junit.jupiter.api.BeforeEach) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) StreamObserverTest.safeSync(io.servicetalk.http.netty.StreamObserverTest.safeSync) TRACE(io.servicetalk.logging.api.LogLevel.TRACE) SingleSource(io.servicetalk.concurrent.SingleSource) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) Cancellable(io.servicetalk.concurrent.Cancellable) MulticastTransportEventsStreamingHttpConnectionFilter(io.servicetalk.http.netty.StreamObserverTest.MulticastTransportEventsStreamingHttpConnectionFilter) MAX_CONCURRENCY(io.servicetalk.http.api.HttpEventKey.MAX_CONCURRENCY) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) HttpExecutionStrategies.defaultStrategy(io.servicetalk.http.api.HttpExecutionStrategies.defaultStrategy) HostAndPort.of(io.servicetalk.transport.api.HostAndPort.of) RegisterExtension(org.junit.jupiter.api.extension.RegisterExtension) EchoHttp2Handler(io.servicetalk.http.netty.H2PriorKnowledgeFeatureParityTest.EchoHttp2Handler) HttpClient(io.servicetalk.http.api.HttpClient) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) ReservedHttpConnection(io.servicetalk.http.api.ReservedHttpConnection) Nullable(javax.annotation.Nullable) HttpProtocolConfigs.h2(io.servicetalk.http.netty.HttpProtocolConfigs.h2) Matchers.empty(org.hamcrest.Matchers.empty) EventLoopGroup(io.netty.channel.EventLoopGroup) ChannelInitializer(io.netty.channel.ChannelInitializer) NettyIoExecutors.createIoExecutor(io.servicetalk.transport.netty.internal.NettyIoExecutors.createIoExecutor) Single(io.servicetalk.concurrent.api.Single) HttpResponse(io.servicetalk.http.api.HttpResponse) ExecutionContextExtension(io.servicetalk.transport.netty.internal.ExecutionContextExtension) BlockingQueue(java.util.concurrent.BlockingQueue) MILLISECONDS(java.util.concurrent.TimeUnit.MILLISECONDS) StreamingHttpConnectionFilter(io.servicetalk.http.api.StreamingHttpConnectionFilter) OK(io.servicetalk.http.api.HttpResponseStatus.OK) H2PriorKnowledgeFeatureParityTest.bindH2Server(io.servicetalk.http.netty.H2PriorKnowledgeFeatureParityTest.bindH2Server) InetSocketAddress(java.net.InetSocketAddress) Integer.parseInt(java.lang.Integer.parseInt) Http2HeadersFrame(io.netty.handler.codec.http2.Http2HeadersFrame) HttpClients.forResolvedAddress(io.servicetalk.http.netty.HttpClients.forResolvedAddress) Channel(io.netty.channel.Channel) Test(org.junit.jupiter.api.Test) CountDownLatch(java.util.concurrent.CountDownLatch) AfterEach(org.junit.jupiter.api.AfterEach) HttpsProxyTest.safeClose(io.servicetalk.http.netty.HttpsProxyTest.safeClose) RetryingHttpRequesterFilter.disableAutoRetries(io.servicetalk.http.netty.RetryingHttpRequesterFilter.disableAutoRetries) SimpleChannelInboundHandler(io.netty.channel.SimpleChannelInboundHandler) LinkedBlockingDeque(java.util.concurrent.LinkedBlockingDeque) Matchers.is(org.hamcrest.Matchers.is) Http2StreamChannel(io.netty.handler.codec.http2.Http2StreamChannel) Duration.ofMillis(java.time.Duration.ofMillis) HostAndPort(io.servicetalk.transport.api.HostAndPort) Http2HeadersFrame(io.netty.handler.codec.http2.Http2HeadersFrame) SingleSource(io.servicetalk.concurrent.SingleSource) Cancellable(io.servicetalk.concurrent.Cancellable) EchoHttp2Handler(io.servicetalk.http.netty.H2PriorKnowledgeFeatureParityTest.EchoHttp2Handler) MulticastTransportEventsStreamingHttpConnectionFilter(io.servicetalk.http.netty.StreamObserverTest.MulticastTransportEventsStreamingHttpConnectionFilter) ChannelHandlerContext(io.netty.channel.ChannelHandlerContext) CountDownLatch(java.util.concurrent.CountDownLatch) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) HostAndPort(io.servicetalk.transport.api.HostAndPort) MulticastTransportEventsStreamingHttpConnectionFilter(io.servicetalk.http.netty.StreamObserverTest.MulticastTransportEventsStreamingHttpConnectionFilter) StreamingHttpConnectionFilter(io.servicetalk.http.api.StreamingHttpConnectionFilter) ChannelInitializer(io.netty.channel.ChannelInitializer) StreamingHttpRequest(io.servicetalk.http.api.StreamingHttpRequest) StreamingHttpResponse(io.servicetalk.http.api.StreamingHttpResponse) Http2StreamChannel(io.netty.handler.codec.http2.Http2StreamChannel) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

HostAndPort (io.servicetalk.transport.api.HostAndPort)29 InetSocketAddress (java.net.InetSocketAddress)23 AddressUtils.serverHostAndPort (io.servicetalk.transport.netty.internal.AddressUtils.serverHostAndPort)20 ServerContext (io.servicetalk.transport.api.ServerContext)10 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)9 Test (org.junit.jupiter.api.Test)9 StreamingHttpRequest (io.servicetalk.http.api.StreamingHttpRequest)8 StreamingHttpResponse (io.servicetalk.http.api.StreamingHttpResponse)8 AddressUtils.localAddress (io.servicetalk.transport.netty.internal.AddressUtils.localAddress)8 Completable.completed (io.servicetalk.concurrent.api.Completable.completed)7 Publisher (io.servicetalk.concurrent.api.Publisher)7 Single (io.servicetalk.concurrent.api.Single)7 StreamingHttpClientFilterFactory (io.servicetalk.http.api.StreamingHttpClientFilterFactory)7 ExecutionException (java.util.concurrent.ExecutionException)7 Publisher.from (io.servicetalk.concurrent.api.Publisher.from)6 FilterableStreamingHttpClient (io.servicetalk.http.api.FilterableStreamingHttpClient)6 StreamingHttpClient (io.servicetalk.http.api.StreamingHttpClient)6 BlockingQueue (java.util.concurrent.BlockingQueue)6 Matchers.notNullValue (org.hamcrest.Matchers.notNullValue)6 Assertions.assertThrows (org.junit.jupiter.api.Assertions.assertThrows)6