use of org.apache.coyote.AbstractProtocol in project spring-boot by spring-projects.
the class SampleTomcatApplicationTests method testTimeout.
@Test
public void testTimeout() throws Exception {
ServletWebServerApplicationContext context = (ServletWebServerApplicationContext) this.applicationContext;
TomcatWebServer embeddedServletContainer = (TomcatWebServer) context.getWebServer();
ProtocolHandler protocolHandler = embeddedServletContainer.getTomcat().getConnector().getProtocolHandler();
int timeout = ((AbstractProtocol<?>) protocolHandler).getConnectionTimeout();
assertThat(timeout).isEqualTo(5000);
}
use of org.apache.coyote.AbstractProtocol in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method customTomcatAcceptCount.
@Test
public void customTomcatAcceptCount() {
Map<String, String> map = new HashMap<>();
map.put("server.tomcat.accept-count", "10");
bindProperties(map);
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
this.customizer.customize(factory);
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
embeddedFactory.start();
try {
assertThat(((AbstractProtocol<?>) embeddedFactory.getTomcat().getConnector().getProtocolHandler()).getBacklog()).isEqualTo(10);
} finally {
embeddedFactory.stop();
}
}
use of org.apache.coyote.AbstractProtocol in project spring-boot by spring-projects.
the class DefaultServletWebServerFactoryCustomizerTests method customTomcatMaxConnections.
@Test
public void customTomcatMaxConnections() {
Map<String, String> map = new HashMap<>();
map.put("server.tomcat.max-connections", "5");
bindProperties(map);
TomcatServletWebServerFactory factory = new TomcatServletWebServerFactory(0);
this.customizer.customize(factory);
TomcatWebServer embeddedFactory = (TomcatWebServer) factory.getWebServer();
embeddedFactory.start();
try {
assertThat(((AbstractProtocol<?>) embeddedFactory.getTomcat().getConnector().getProtocolHandler()).getMaxConnections()).isEqualTo(5);
} finally {
embeddedFactory.stop();
}
}
Aggregations