I want my Spring Boot application with embedded Tomcat to reset connection if request is being processed more than 3 seconds. But there is no way I could do that. The last of my code snippets is:
@SpringBootApplication
@ComponentScan(basePackages = {"."})
@Controller
public class ExternalServerApplication {
    public static void main(String[] args) {
        SpringApplication.run(ExternalServerApplication.class, args);
    }
    @Bean
    public EmbeddedServletContainerFactory servletContainerFactory() {
        TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
        factory.addConnectorCustomizers(
                connector -> {
                    AbstractProtocol protocol = (AbstractProtocol) connector.getProtocolHandler();
                    protocol.setConnectionTimeout(1);
                    protocol.setKeepAliveTimeout(1);
                    protocol.setSoTimeout(1);
                    protocol.setPort(8012);
                    protocol.setMaxThreads(10);
                });
        return factory;
    }
    @RequestMapping("/request")
    @ResponseBody
    public String request() throws InterruptedException {
        for (int i = 0; i < 50; i++) {
            Thread.sleep(100);
        }
        return "OK";
    }
}
But it doesn't work either.
The request to localhost:8012/requests lasts for 5 seconds and returns "OK", but it should be reseted.
Any ideas?