<commit_before>package io.dropwizard.http2;

import io.dropwizard.logging.BootstrapLogging;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.BufferingResponseListener;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

import java.nio.charset.StandardCharsets;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static io.dropwizard.testing.ResourceHelpers.resourceFilePath;
import static org.assertj.core.api.Assertions.assertThat;

/**
 * Common code for HTTP/2 connector tests
 */
class Http2TestCommon {

    static {
        BootstrapLogging.bootstrap();
    }

    final SslContextFactory.Client sslContextFactory = new SslContextFactory.Client();
    HttpClient http2Client;
    HttpClient http1Client;

    @BeforeEach
    void setUp() throws Exception {
        sslContextFactory.setTrustStorePath(resourceFilePath("stores/http2_client.jts"));
        sslContextFactory.setTrustStorePassword("<PASSWORD>");
        sslContextFactory.start();

        http1Client = new HttpClient(sslContextFactory);
        http1Client.start();

        http2Client = new HttpClient(new HttpClientTransportOverHTTP2(new HTTP2Client()), sslContextFactory);
        http2Client.start();

    }

    @AfterEach<commit_msg>Use Jetty's `Resource` to locate truststore in `Http2TestCommon` (#4926)<commit_after>package io.dropwizard.http2;

import io.dropwizard.logging.BootstrapLogging;
import org.eclipse.jetty.client.HttpClient;
import org.eclipse.jetty.client.api.ContentResponse;
import org.eclipse.jetty.client.api.Result;
import org.eclipse.jetty.client.util.BufferingResponseListener;
import org.eclipse.jetty.http.HttpVersion;
import org.eclipse.jetty.http2.client.HTTP2Client;
import org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2;
import org.eclipse.jetty.util.ssl.SslContextFactory;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;

import java.nio.charset.StandardCharsets;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.TimeUnit;

import static org.assertj.core.api.Assertions.assertThat;
import static org.eclipse.jetty.util.resource.Resource.newResource;

/**
 * Common code for HTTP/2 connector tests
 */
class Http2TestCommon {

    static {
        BootstrapLogging.bootstrap();
    }

    final SslContextFactory.Client sslContextFactory = new SslContextFactory.Client();
    HttpClient http2Client;
    HttpClient http1Client;

    @BeforeEach
    void setUp() throws Exception {
        sslContextFactory.setTrustStoreResource(newResource(getClass().getResource("/stores/http2_client.jts")));
        sslContextFactory.setTrustStorePassword("<PASSWORD>");
        sslContextFactory.start();

        http1Client = new HttpClient(sslContextFactory);
        http1Client.start();

        http2Client = new HttpClient(new HttpClientTransportOverHTTP2(new HTTP2Client()), sslContextFactory);
        http2Client.start();

    }

    @AfterEach
{'fraction_non_alphanumeric': 0.10110679030810649, 'fraction_numerical': 0.011067903081064912, 'mean_word_length': 4.815652173913043, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5630190', 'n_tokens_mistral': 1011, 'n_tokens_neox': 980, 'n_words': 157}