use of org.apache.catalina.connector.Connector in project spring-boot by spring-projects.
the class TomcatServletWebServerFactoryTests method tomcatAdditionalConnectors.
@Test
public void tomcatAdditionalConnectors() throws Exception {
TomcatServletWebServerFactory factory = getFactory();
Connector[] listeners = new Connector[4];
for (int i = 0; i < listeners.length; i++) {
Connector connector = mock(Connector.class);
given(connector.getState()).willReturn(LifecycleState.STOPPED);
listeners[i] = connector;
}
factory.addAdditionalTomcatConnectors(listeners);
this.webServer = factory.getWebServer();
Map<Service, Connector[]> connectors = ((TomcatWebServer) this.webServer).getServiceConnectors();
assertThat(connectors.values().iterator().next().length).isEqualTo(listeners.length + 1);
}
use of org.apache.catalina.connector.Connector in project spring-boot by spring-projects.
the class TomcatServletWebServerFactoryTests method sslEnabledMultipleProtocolsConfiguration.
@Test
public void sslEnabledMultipleProtocolsConfiguration() throws Exception {
Ssl ssl = getSsl(null, "password", "src/test/resources/test.jks");
ssl.setEnabledProtocols(new String[] { "TLSv1.1", "TLSv1.2" });
ssl.setCiphers(new String[] { "TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256", "BRAVO" });
TomcatServletWebServerFactory factory = getFactory();
factory.setSsl(ssl);
this.webServer = factory.getWebServer(sessionServletRegistration());
this.webServer.start();
Tomcat tomcat = ((TomcatWebServer) this.webServer).getTomcat();
Connector connector = tomcat.getConnector();
SSLHostConfig sslHostConfig = connector.getProtocolHandler().findSslHostConfigs()[0];
assertThat(sslHostConfig.getSslProtocol()).isEqualTo("TLS");
assertThat(sslHostConfig.getEnabledProtocols()).containsExactlyInAnyOrder("TLSv1.1", "TLSv1.2");
}
use of org.apache.catalina.connector.Connector in project spring-boot by spring-projects.
the class TomcatWebServer method getPortsDescription.
private String getPortsDescription(boolean localPort) {
StringBuilder ports = new StringBuilder();
for (Connector connector : this.tomcat.getService().findConnectors()) {
ports.append(ports.length() == 0 ? "" : " ");
int port = (localPort ? connector.getLocalPort() : connector.getPort());
ports.append(port + " (" + connector.getScheme() + ")");
}
return ports.toString();
}
use of org.apache.catalina.connector.Connector in project async-http-client by AsyncHttpClient.
the class WebDavBasicTest method setUpGlobal.
@BeforeClass(alwaysRun = true)
public void setUpGlobal() throws Exception {
embedded = new Embedded();
String path = new File(".").getAbsolutePath();
embedded.setCatalinaHome(path);
Engine engine = embedded.createEngine();
engine.setDefaultHost("localhost");
Host host = embedded.createHost("localhost", path);
engine.addChild(host);
Context c = embedded.createContext("/", path);
c.setReloadable(false);
Wrapper w = c.createWrapper();
w.addMapping("/*");
w.setServletClass(org.apache.catalina.servlets.WebdavServlet.class.getName());
w.addInitParameter("readonly", "false");
w.addInitParameter("listings", "true");
w.setLoadOnStartup(0);
c.addChild(w);
host.addChild(c);
Connector connector = embedded.createConnector("localhost", 0, Http11NioProtocol.class.getName());
connector.setContainer(host);
embedded.addEngine(engine);
embedded.addConnector(connector);
embedded.start();
port1 = connector.getLocalPort();
}
use of org.apache.catalina.connector.Connector in project tomee by apache.
the class TomcatRsRegistry method address.
private static String address(final Collection<Connector> connectors, final String host, final String path) {
final List<String> addresses = new ArrayList<>();
for (final Connector connector : connectors) {
final URI address;
try {
address = new URI(connector.getScheme(), null, host, connector.getPort(), path, null, null);
} catch (final Exception e) {
// just an URI problem normally...shouldn't occur
LOGGER.error("can't add container for path " + path, e);
continue;
}
addresses.add(address.toString());
}
return HttpUtil.selectSingleAddress(addresses);
}
Aggregations