i have tried lowering the connection timeout from 60000 to just 100 millseconds to see whether it is breaking or not. But it is working fine even if the response time is more than 2000 millseconds .
Mine is springboot project,please let me know what is the way to test this connection timeout or let me know if i'm doing anything wrong???
@Component("tomcat")
public class TomcatServer {
private static final Logger LOGGER = LogManager.getLogger(TomcatServer.class);
@Value("${server.connection.timeout:60000}")
private int connectionTimeout;
@Value("${server.connection.keepalive.timeout:60000}")
private int keepAliveTimeout;
@Value("${server.connection.keepalive.count:100}")
private int maxKeepAliveRequests;
@Bean
public TomcatEmbeddedServletContainerFactory tomcatFactory(@Autowired final ContextResource primaryDS) {
final TomcatEmbeddedServletContainerFactory tcFactory = new TomcatEmbeddedServletContainerFactory() {
@Override
protected TomcatEmbeddedServletContainer getTomcatEmbeddedServletContainer(
final Tomcat tomcat) {
tomcat.enableNaming();
return super.getTomcatEmbeddedServletContainer(tomcat);
}
@Override
protected void postProcessContext(final Context context) {
context.getNamingResources().addResource(primaryDS);
}
};
tcFactory.addConnectorCustomizers(connector -> {
final Http11NioProtocol proto = (Http11NioProtocol) connector.getProtocolHandler();
LOGGER.info("connectionTimeout=" + connectionTimeout);
LOGGER.info("keepAliveTimeout=" + keepAliveTimeout);
LOGGER.info("maxKeepAliveRequests=" + maxKeepAliveRequests);
proto.setConnectionTimeout(connectionTimeout);
proto.setKeepAliveTimeout(keepAliveTimeout);
proto.setMaxKeepAliveRequests(maxKeepAliveRequests);
});
return tcFactory;
}
}```