Search in sources :

Example 1 with HTTP2ClientConnectionFactory

use of org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory in project jetty.project by eclipse.

the class HttpClientTransportOverHTTP2 method doStart.

@Override
protected void doStart() throws Exception {
    if (!client.isStarted()) {
        client.setExecutor(httpClient.getExecutor());
        client.setScheduler(httpClient.getScheduler());
        client.setByteBufferPool(httpClient.getByteBufferPool());
        client.setConnectTimeout(httpClient.getConnectTimeout());
        client.setIdleTimeout(httpClient.getIdleTimeout());
        client.setInputBufferSize(httpClient.getResponseBufferSize());
    }
    addBean(client);
    super.doStart();
    this.connectionFactory = new HTTP2ClientConnectionFactory();
    client.setClientConnectionFactory((endPoint, context) -> {
        HttpDestination destination = (HttpDestination) context.get(HTTP_DESTINATION_CONTEXT_KEY);
        return destination.getClientConnectionFactory().newConnection(endPoint, context);
    });
}
Also used : HTTP2ClientConnectionFactory(org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory) HttpDestination(org.eclipse.jetty.client.HttpDestination)

Example 2 with HTTP2ClientConnectionFactory

use of org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory in project dropwizard by dropwizard.

the class Http2CIntegrationTest method setUp.

@BeforeEach
@Override
void setUp() throws Exception {
    final HTTP2Client http2Client = new HTTP2Client();
    // No need for ALPN
    http2Client.setClientConnectionFactory(new HTTP2ClientConnectionFactory());
    this.http2Client = new HttpClient(new HttpClientTransportOverHTTP2(http2Client), null);
    this.http2Client.start();
    this.http1Client = new HttpClient();
    this.http1Client.start();
}
Also used : HTTP2ClientConnectionFactory(org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory) HttpClientTransportOverHTTP2(org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2) HttpClient(org.eclipse.jetty.client.HttpClient) HTTP2Client(org.eclipse.jetty.http2.client.HTTP2Client) BeforeEach(org.junit.jupiter.api.BeforeEach)

Aggregations

HTTP2ClientConnectionFactory (org.eclipse.jetty.http2.client.HTTP2ClientConnectionFactory)2 HttpClient (org.eclipse.jetty.client.HttpClient)1 HttpDestination (org.eclipse.jetty.client.HttpDestination)1 HTTP2Client (org.eclipse.jetty.http2.client.HTTP2Client)1 HttpClientTransportOverHTTP2 (org.eclipse.jetty.http2.client.http.HttpClientTransportOverHTTP2)1 BeforeEach (org.junit.jupiter.api.BeforeEach)1