Example usage for org.apache.http.localserver SSLTestContexts createServerSSLContext

List of usage examples for org.apache.http.localserver SSLTestContexts createServerSSLContext

Introduction

In this page you can find the example usage for org.apache.http.localserver SSLTestContexts createServerSSLContext.

Prototype

public static SSLContext createServerSSLContext() throws Exception 

Source Link

Usage

From source file:org.apache.sling.hapi.client.test.util.HttpServerRule.java

@Override
protected void before() throws Throwable {
    final SocketConfig socketConfig = SocketConfig.custom().setSoTimeout(5000).build();
    serverBootstrap = ServerBootstrap.bootstrap().setSocketConfig(socketConfig).setServerInfo(ORIGIN);
    if (ProtocolScheme.https.equals(protocolScheme)) {
        serverBootstrap.setSslContext(SSLTestContexts.createServerSSLContext());
    }//  w w  w . java 2  s  . com
    registerHandlers();
    server = serverBootstrap.create();
    server.start();
    host = new HttpHost("127.0.0.1", server.getLocalPort(), protocolScheme.name());
    uri = URIUtils.rewriteURI(new URI("/"), host);
}