|
39 | 39 | import org.apache.hc.core5.http.Header;
|
40 | 40 | import org.apache.hc.core5.http.HttpResponse;
|
41 | 41 | import org.apache.jasper.servlet.JspServlet;
|
| 42 | +import org.assertj.core.api.InstanceOfAssertFactories; |
42 | 43 | import org.awaitility.Awaitility;
|
43 | 44 | import org.eclipse.jetty.ee10.servlet.ErrorPageErrorHandler;
|
44 | 45 | import org.eclipse.jetty.ee10.servlet.ServletHolder;
|
45 | 46 | import org.eclipse.jetty.ee10.webapp.AbstractConfiguration;
|
46 | 47 | import org.eclipse.jetty.ee10.webapp.ClassMatcher;
|
47 | 48 | import org.eclipse.jetty.ee10.webapp.Configuration;
|
48 | 49 | import org.eclipse.jetty.ee10.webapp.WebAppContext;
|
| 50 | +import org.eclipse.jetty.server.AbstractConnector; |
49 | 51 | import org.eclipse.jetty.server.ConnectionLimit;
|
50 | 52 | import org.eclipse.jetty.server.Connector;
|
51 | 53 | import org.eclipse.jetty.server.Handler;
|
|
85 | 87 | * @author Andy Wilkinson
|
86 | 88 | * @author Henri Kerola
|
87 | 89 | * @author Moritz Halbritter
|
| 90 | + * @author Onur Kagan Ozcan |
88 | 91 | */
|
89 | 92 | class JettyServletWebServerFactoryTests extends AbstractServletWebServerFactoryTests {
|
90 | 93 |
|
@@ -541,6 +544,19 @@ void shouldApplyMaxConnections() {
|
541 | 544 | assertThat(connectionLimit.getMaxConnections()).isOne();
|
542 | 545 | }
|
543 | 546 |
|
| 547 | + @Test |
| 548 | + void shouldApplyingMaxConnectionUseConnector() throws Exception { |
| 549 | + JettyServletWebServerFactory factory = getFactory(); |
| 550 | + factory.setMaxConnections(1); |
| 551 | + this.webServer = factory.getWebServer(); |
| 552 | + Server server = ((JettyWebServer) this.webServer).getServer(); |
| 553 | + assertThat(server.getConnectors()).isEmpty(); |
| 554 | + ConnectionLimit connectionLimit = server.getBean(ConnectionLimit.class); |
| 555 | + assertThat(connectionLimit).extracting("_connectors") |
| 556 | + .asInstanceOf(InstanceOfAssertFactories.list(AbstractConnector.class)) |
| 557 | + .hasSize(1); |
| 558 | + } |
| 559 | + |
544 | 560 | @Override
|
545 | 561 | protected String startedLogMessage() {
|
546 | 562 | return ((JettyWebServer) this.webServer).getStartedLogMessage();
|
|
0 commit comments