Java Code Examples for com.linecorp.armeria.common.SessionProtocol#HTTP

The following examples show how to use com.linecorp.armeria.common.SessionProtocol#HTTP . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SamlPortConfigBuilder.java    From armeria with Apache License 2.0 5 votes vote down vote up
/**
 * Sets a {@link SessionProtocol} only if it has not been specified before.
 */
SamlPortConfigBuilder setSchemeIfAbsent(SessionProtocol scheme) {
    requireNonNull(scheme, "scheme");
    if (this.scheme == null) {
        if (scheme == SessionProtocol.HTTPS ||
            scheme == SessionProtocol.HTTP) {
            this.scheme = scheme;
        } else {
            throw new IllegalArgumentException("unexpected session protocol: " + scheme);
        }
    }
    return this;
}
 
Example 2
Source File: ArmeriaCallFactory.java    From armeria with Apache License 2.0 5 votes vote down vote up
WebClient getWebClient(HttpUrl url) {
    if (baseWebClient.scheme().sessionProtocol().isTls() == url.isHttps() &&
        baseWebClientHost.equals(url.host()) &&
        baseWebClientPort == url.port()) {

        return baseWebClient;
    }

    final SessionProtocol protocol = url.isHttps() ? SessionProtocol.HTTPS : SessionProtocol.HTTP;
    final Endpoint endpoint = Endpoint.of(url.host(), url.port());
    return nonBaseWebClientFactory.apply(protocol, endpoint);
}
 
Example 3
Source File: DefaultEventLoopScheduler.java    From armeria with Apache License 2.0 5 votes vote down vote up
private static boolean isHttp1(SessionProtocol sessionProtocol, Endpoint endpointWithPort) {
    if (sessionProtocol == SessionProtocol.H1C || sessionProtocol == SessionProtocol.H1) {
        return true;
    }

    if (sessionProtocol == SessionProtocol.HTTP) {
        return SessionProtocolNegotiationCache.isUnsupported(endpointWithPort, SessionProtocol.H2C);
    }

    if (sessionProtocol == SessionProtocol.HTTPS) {
        return SessionProtocolNegotiationCache.isUnsupported(endpointWithPort, SessionProtocol.H2);
    }

    return false;
}
 
Example 4
Source File: HealthCheckedEndpointGroupTest.java    From armeria with Apache License 2.0 5 votes vote down vote up
@Test
void updatesSelectedCandidatesNoStackOverflowEvenUpdatesOnEqualThread() {
    final AtomicReference<HealthCheckerContext> firstSelectedCandidates = new AtomicReference<>();
    final Function<? super HealthCheckerContext, ? extends AsyncCloseable> checkFactory = ctx -> {
        if (firstSelectedCandidates.get() == null) {
            firstSelectedCandidates.set(ctx);
        }

        ctx.updateHealth(HEALTHY);
        return AsyncCloseableSupport.of();
    };

    final Endpoint candidate1 = Endpoint.of("candidate1");
    final Endpoint candidate2 = Endpoint.of("candidate2");

    final MockEndpointGroup delegate = new MockEndpointGroup();
    delegate.set(candidate1, candidate2);

    try (HealthCheckedEndpointGroup group =
                 new HealthCheckedEndpointGroup(delegate, SessionProtocol.HTTP, 80,
                                                DEFAULT_HEALTH_CHECK_RETRY_BACKOFF,
                                                ClientOptions.of(), checkFactory,
                                                new InfinityUpdateHealthCheckStrategy())) {

        assertThat(group.healthyEndpoints).containsOnly(candidate1, candidate2);

        firstSelectedCandidates.get().updateHealth(UNHEALTHY);
        assertThat(group.healthyEndpoints).containsOnly(candidate2);
    }
}
 
Example 5
Source File: ZipkinElasticsearchAwsStorageModuleTest.java    From zipkin-aws with Apache License 2.0 4 votes vote down vote up
@Bean @Qualifier(QUALIFIER) @ConditionalOnMissingBean SessionProtocol esSessionProtocol() {
  return SessionProtocol.HTTP;
}