use of org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext in project spring-boot by spring-projects.
the class TomcatLegacyCookieProcessorExampleTests method cookieProcessorIsCustomized.
@Test
public void cookieProcessorIsCustomized() {
ServletWebServerApplicationContext applicationContext = (ServletWebServerApplicationContext) new SpringApplication(TestConfiguration.class, LegacyCookieProcessorConfiguration.class).run();
Context context = (Context) ((TomcatWebServer) applicationContext.getWebServer()).getTomcat().getHost().findChildren()[0];
assertThat(context.getCookieProcessor()).isInstanceOf(LegacyCookieProcessor.class);
}
use of org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext in project spring-boot by spring-projects.
the class EmbeddedServerPortFileWriterTests method mockEvent.
private ServletWebServerInitializedEvent mockEvent(String name, int port) {
ServletWebServerApplicationContext applicationContext = mock(ServletWebServerApplicationContext.class);
WebServer source = mock(WebServer.class);
given(applicationContext.getNamespace()).willReturn(name);
given(source.getPort()).willReturn(port);
ServletWebServerInitializedEvent event = new ServletWebServerInitializedEvent(applicationContext, source);
return event;
}
use of org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext 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);
}
Aggregations