@Configuration
public class TestHttpsProxyContainer extends GenericTestProxyContainer {
@Bean
public EmbeddedServletContainerFactory servletContainer() throws Exception {
TomcatEmbeddedServletContainerFactory factory = new TomcatEmbeddedServletContainerFactory();
MockService config = MockService.getInstance();
factory.setPort(config.getPort());
factory.setSessionTimeout(10, TimeUnit.MINUTES);
factory.addContextCustomizers(new TomcatContextCustomizer() {
@Override
public void customize(Context context) {
JarScanner jarScanner = new JarScanner() {
@Override
public void scan(ServletContext arg0, ClassLoader arg1,
JarScannerCallback arg2, Set<String> arg3) {
}
};
context.setJarScanner(jarScanner);
}
});
// extract keystores to temp file
// the keystore needs to be in the filesystem and not just on the classpath
// this ensures that it gets unpacked from the jar/war
final File keyStore = com.groupon.odo.proxylib.Utils.copyResourceToLocalFile("tomcat.ks", "tomcat.ks");
// Add HTTPS customization to connector
factory.addConnectorCustomizers(new TomcatConnectorCustomizer() {
@Override
public void customize(Connector connector) {
MockService config = MockService.getInstance();
connector.setPort(config.getPort());
connector.setSecure(true);