|
|
|
@ -48,6 +48,7 @@ import static org.mockito.Mockito.verify;
|
|
|
|
|
*
|
|
|
|
|
* @author Brian Clozel
|
|
|
|
|
* @author Artsiom Yudovin
|
|
|
|
|
* @author Leo Li
|
|
|
|
|
*/
|
|
|
|
|
@ExtendWith(MockitoExtension.class)
|
|
|
|
|
class NettyWebServerFactoryCustomizerTests {
|
|
|
|
@ -117,6 +118,14 @@ class NettyWebServerFactoryCustomizerTests {
|
|
|
|
|
verifyIdleTimeout(factory, Duration.ofSeconds(1));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void setMaxKeepAliveRequests() {
|
|
|
|
|
this.serverProperties.getNetty().setMaxKeepAliveRequests(100);
|
|
|
|
|
NettyReactiveWebServerFactory factory = mock(NettyReactiveWebServerFactory.class);
|
|
|
|
|
this.customizer.customize(factory);
|
|
|
|
|
verifyMaxKeepAliveRequests(factory, 100);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
|
void configureHttpRequestDecoder() {
|
|
|
|
|
ServerProperties.Netty nettyProperties = this.serverProperties.getNetty();
|
|
|
|
@ -162,4 +171,12 @@ class NettyWebServerFactoryCustomizerTests {
|
|
|
|
|
assertThat(idleTimeout).isEqualTo(expected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void verifyMaxKeepAliveRequests(NettyReactiveWebServerFactory factory, int expected) {
|
|
|
|
|
verify(factory, times(2)).addServerCustomizers(this.customizerCaptor.capture());
|
|
|
|
|
NettyServerCustomizer serverCustomizer = this.customizerCaptor.getAllValues().get(0);
|
|
|
|
|
HttpServer httpServer = serverCustomizer.apply(HttpServer.create());
|
|
|
|
|
int maxKeepAliveRequests = httpServer.configuration().maxKeepAliveRequests();
|
|
|
|
|
assertThat(maxKeepAliveRequests).isEqualTo(expected);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|