Search in sources :

Example 1 with JettyClientHttpConnector

use of org.springframework.http.client.reactive.JettyClientHttpConnector in project spring-boot by spring-projects.

the class ClientHttpConnectorConfigurationTests method jettyClientHttpConnectorAppliesJettyResourceFactory.

@Test
void jettyClientHttpConnectorAppliesJettyResourceFactory() {
    Executor executor = mock(Executor.class);
    ByteBufferPool byteBufferPool = mock(ByteBufferPool.class);
    Scheduler scheduler = mock(Scheduler.class);
    JettyResourceFactory jettyResourceFactory = new JettyResourceFactory();
    jettyResourceFactory.setExecutor(executor);
    jettyResourceFactory.setByteBufferPool(byteBufferPool);
    jettyResourceFactory.setScheduler(scheduler);
    JettyClientHttpConnector connector = getClientHttpConnector(jettyResourceFactory);
    HttpClient httpClient = (HttpClient) ReflectionTestUtils.getField(connector, "httpClient");
    assertThat(httpClient.getExecutor()).isSameAs(executor);
    assertThat(httpClient.getByteBufferPool()).isSameAs(byteBufferPool);
    assertThat(httpClient.getScheduler()).isSameAs(scheduler);
}
Also used : ByteBufferPool(org.eclipse.jetty.io.ByteBufferPool) JettyResourceFactory(org.springframework.http.client.reactive.JettyResourceFactory) Executor(java.util.concurrent.Executor) Scheduler(org.eclipse.jetty.util.thread.Scheduler) HttpClient(org.eclipse.jetty.client.HttpClient) JettyClientHttpConnector(org.springframework.http.client.reactive.JettyClientHttpConnector) Test(org.junit.jupiter.api.Test)

Example 2 with JettyClientHttpConnector

use of org.springframework.http.client.reactive.JettyClientHttpConnector in project spring-boot by spring-projects.

the class ClientHttpConnectorConfigurationTests method JettyResourceFactoryHasSslContextFactory.

@Test
void JettyResourceFactoryHasSslContextFactory() {
    // gh-16810
    JettyResourceFactory jettyResourceFactory = new JettyResourceFactory();
    JettyClientHttpConnector connector = getClientHttpConnector(jettyResourceFactory);
    HttpClient httpClient = (HttpClient) ReflectionTestUtils.getField(connector, "httpClient");
    assertThat(httpClient.getSslContextFactory()).isNotNull();
}
Also used : JettyResourceFactory(org.springframework.http.client.reactive.JettyResourceFactory) HttpClient(org.eclipse.jetty.client.HttpClient) JettyClientHttpConnector(org.springframework.http.client.reactive.JettyClientHttpConnector) Test(org.junit.jupiter.api.Test)

Aggregations

HttpClient (org.eclipse.jetty.client.HttpClient)2 Test (org.junit.jupiter.api.Test)2 JettyClientHttpConnector (org.springframework.http.client.reactive.JettyClientHttpConnector)2 JettyResourceFactory (org.springframework.http.client.reactive.JettyResourceFactory)2 Executor (java.util.concurrent.Executor)1 ByteBufferPool (org.eclipse.jetty.io.ByteBufferPool)1 Scheduler (org.eclipse.jetty.util.thread.Scheduler)1