Search in sources :

Example 16 with Connector

use of org.apache.catalina.connector.Connector in project sonarqube by SonarSource.

the class StartupLogsTest method newConnector.

private Connector newConnector(String protocol, String schema) {
    Connector httpConnector = new Connector(protocol);
    httpConnector.setScheme(schema);
    httpConnector.setPort(1234);
    return httpConnector;
}
Also used : Connector(org.apache.catalina.connector.Connector)

Example 17 with Connector

use of org.apache.catalina.connector.Connector in project sonarqube by SonarSource.

the class TomcatConnectorsTest method test_max_post_size_for_http_connection.

@Test
public void test_max_post_size_for_http_connection() throws Exception {
    Properties properties = new Properties();
    Props props = new Props(properties);
    TomcatConnectors.configure(tomcat, props);
    verify(tomcat.getService()).addConnector(argThat(new ArgumentMatcher<Connector>() {

        @Override
        public boolean matches(Object o) {
            Connector c = (Connector) o;
            return c.getMaxPostSize() == -1;
        }
    }));
}
Also used : Connector(org.apache.catalina.connector.Connector) ArgumentMatcher(org.mockito.ArgumentMatcher) Properties(java.util.Properties) Props(org.sonar.process.Props) Test(org.junit.Test)

Example 18 with Connector

use of org.apache.catalina.connector.Connector in project sonarqube by SonarSource.

the class TomcatConnectorsTest method bind_to_specific_address.

@Test
public void bind_to_specific_address() {
    Properties p = new Properties();
    p.setProperty("sonar.web.port", "9000");
    p.setProperty("sonar.web.host", "1.2.3.4");
    TomcatConnectors.configure(tomcat, new Props(p));
    verify(tomcat.getService()).addConnector(argThat(new ArgumentMatcher<Connector>() {

        @Override
        public boolean matches(Object o) {
            Connector c = (Connector) o;
            return c.getScheme().equals("http") && c.getPort() == 9000 && ((InetAddress) c.getProperty("address")).getHostAddress().equals("1.2.3.4");
        }
    }));
}
Also used : Connector(org.apache.catalina.connector.Connector) ArgumentMatcher(org.mockito.ArgumentMatcher) Properties(java.util.Properties) Props(org.sonar.process.Props) InetAddress(java.net.InetAddress) Test(org.junit.Test)

Example 19 with Connector

use of org.apache.catalina.connector.Connector in project spring-boot by spring-projects.

the class SampleTomcatTwoConnectorsApplication method createStandardConnector.

private Connector createStandardConnector() {
    Connector connector = new Connector("org.apache.coyote.http11.Http11NioProtocol");
    connector.setPort(port());
    return connector;
}
Also used : Connector(org.apache.catalina.connector.Connector)

Example 20 with Connector

use of org.apache.catalina.connector.Connector in project spring-boot by spring-projects.

the class TomcatReactiveWebServerFactory method createTomcatServer.

private Tomcat createTomcatServer() {
    Tomcat tomcat = new Tomcat();
    File baseDir = createTempDir("tomcat");
    tomcat.setBaseDir(baseDir.getAbsolutePath());
    Connector connector = new Connector(this.protocol);
    tomcat.getService().addConnector(connector);
    customizeConnector(connector);
    tomcat.setConnector(connector);
    tomcat.getHost().setAutoDeploy(false);
    return tomcat;
}
Also used : Connector(org.apache.catalina.connector.Connector) Tomcat(org.apache.catalina.startup.Tomcat) File(java.io.File)

Aggregations

Connector (org.apache.catalina.connector.Connector)66 Test (org.junit.Test)16 Service (org.apache.catalina.Service)14 File (java.io.File)10 Tomcat (org.apache.catalina.startup.Tomcat)10 Context (org.apache.catalina.Context)6 Engine (org.apache.catalina.Engine)6 Properties (java.util.Properties)5 StandardService (org.apache.catalina.core.StandardService)5 SSLHostConfig (org.apache.tomcat.util.net.SSLHostConfig)5 IOException (java.io.IOException)4 URI (java.net.URI)4 ArrayList (java.util.ArrayList)4 Executor (org.apache.catalina.Executor)4 HashMap (java.util.HashMap)3 ObjectName (javax.management.ObjectName)3 Container (org.apache.catalina.Container)3 LifecycleException (org.apache.catalina.LifecycleException)3 Wrapper (org.apache.catalina.Wrapper)3 InetAddress (java.net.InetAddress)2