APISonar


com.linecorp.armeria.common.SessionProtocol.HTTP

> com > linecorp > armeria > common > SessionProtocol > HTTP
com APIs linecorp APIs armeria APIs common APIs SessionProtocol APIs HTTP APIs

Example 1
protected String url(String path) {
        assertThat(server).isNotNull();
        final int port = server.activePorts().values().stream()
                               .filter(p1 -> p1.hasProtocol(SessionProtocol.HTTP)).findAny()
                               .flatMap(p -> Optional.of(p.localAddress().getPort()))
                               .orElseThrow(() -> new IllegalStateException("Port not open"));
        return "http://127.0.0.1:" + port + path;
    }
Example 2
void endpointShouldBeHost() {
        final DefaultEventLoopScheduler s = defaultEventLoopScheduler();
        assertThatThrownBy(() -> s.acquire(Endpoint.ofGroup("foo"), SessionProtocol.HTTP))
                .isExactlyInstanceOf(IllegalArgumentException.class)
                .hasMessageContaining("endpoint must be a host");
    }
Example 3
void acceptDuplicatePort() throws Exception {
        final Server server = Server.builder()
                                    .http(8080)
                                    .https(8080)
                                    .tlsSelfSigned()
                                    .service("/", (ctx, req) -> HttpResponse.of(HttpStatus.OK))
                                    .build();

        final List<ServerPort> ports = server.config().ports();
        assertThat(ports.size()).isOne(); // merged
        assertThat(ports.get(0).protocols())
                .contains(SessionProtocol.HTTP, SessionProtocol.HTTPS);
    }
Example 4
SessionProtocol esSessionProtocol(ZipkinElasticsearchStorageProperties es) {
    if (es.getHosts() == null) return SessionProtocol.HTTP;
    if (es.getHosts().contains("https://")) return SessionProtocol.HTTPS;
    return SessionProtocol.HTTP;
  }
Example 5
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 6
static AbstractEventLoopEntry acquireEntry(DefaultEventLoopScheduler s, Endpoint endpointA) {
        final ReleasableHolder<EventLoop> acquired = s.acquire(endpointA, SessionProtocol.HTTP);
        assert acquired instanceof AbstractEventLoopEntry;
        return (AbstractEventLoopEntry) acquired;
    }
Example 7
void testServiceDecoration_shouldCatchException() throws Exception {
        final Endpoint endpoint = Endpoint.of(TEST_HOST, server.httpPort()).withIpAddr("127.0.0.1");
        final WebClient webClientTest = WebClient.of(SessionProtocol.HTTP, endpoint);
        final AggregatedHttpResponse join = webClientTest.get("/foo/bar").aggregate().join();

        assertThat(join.status()).isEqualTo(HttpStatus.NOT_IMPLEMENTED);
    }
Example 8
public void givenClients_whenBinary_thenBuildClient() throws Exception {
        HelloService.Iface client =
                new ClientBuilder(Scheme.of(BINARY, SessionProtocol.HTTP), newEndpoint(BINARY))
                        .path("/hello")
                        .build(HelloService.Iface.class);
        assertThat(client.hello("Trustin")).isEqualTo("Hello, Trustin!");

        client = new ClientBuilder(Scheme.of(TEXT, SessionProtocol.HTTP), newEndpoint(TEXT))
                .path("/hello")
                .build(HelloService.Iface.class);
        assertThat(client.hello("Trustin")).isEqualTo("Hello, Trustin!");
    }
Example 9
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;
    }