use of org.webpieces.frontend2.api.HttpSvrConfig in project webpieces by deanhiller.
the class WebServerImpl method startHttpsServer.
private XFuture<Void> startHttpsServer(Injector injector, InetSocketAddress httpsAddress) {
XFuture<Void> fut2;
// This is inside the if statement BECAUSE we do not need to bind an SSLConfiguration if they do not
// enable the backend or https ports
SSLEngineFactory factory = fetchSSLEngineFactory(injector);
String type = "https";
log.info("Creating and starting https over port=" + httpsAddress + " AND using '" + type + "'");
HttpSvrConfig httpSvrConfig = new HttpSvrConfig(type, httpsAddress, 10000);
httpSvrConfig.asyncServerConfig.functionToConfigureBeforeBind = s -> configure(s);
httpsServer = serverMgr.createHttpsServer(httpSvrConfig, serverListener, factory);
fut2 = httpsServer.start();
return fut2;
}
use of org.webpieces.frontend2.api.HttpSvrConfig in project webpieces by deanhiller.
the class AbstractHttp1Test method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockChannel.setIncomingFrameDefaultReturnValue(XFuture.completedFuture(null));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
SimpleMeterRegistry metrics = new SimpleMeterRegistry();
InjectionConfig injConfig = new InjectionConfig(mockTime, config, metrics);
HttpSvrConfig frontendConfig = new HttpSvrConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig, Metrics.globalRegistry);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
simulateClientConnecting();
}
use of org.webpieces.frontend2.api.HttpSvrConfig in project webpieces by deanhiller.
the class TestS3InitialHttpConnections method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockTcpChannel.setIncomingFrameDefaultReturnValue(XFuture.completedFuture(null));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
SimpleMeterRegistry metrics = new SimpleMeterRegistry();
InjectionConfig injConfig = new InjectionConfig(mockTime, config, metrics);
HttpSvrConfig frontendConfig = new HttpSvrConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig, Metrics.globalRegistry);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
XFuture<DataListener> futureList = listener.connected(mockTcpChannel, true);
DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
mockChannel.setDataListener(dataListener);
}
use of org.webpieces.frontend2.api.HttpSvrConfig in project webpieces by deanhiller.
the class WebServerImpl method startBackendServer.
private XFuture<Void> startBackendServer(Injector injector, InetSocketAddress backendAddress) {
XFuture<Void> fut33;
// This is inside the if statement BECAUSE we do not need to bind an SSLConfiguration if they do not
// enable the backend or https ports
SSLConfiguration sslConfiguration = injector.getInstance(SSLConfiguration.class);
String type = "https";
if (sslConfiguration.getBackendSslEngineFactory() == null)
type = "http";
String serverName = "backend." + type;
log.info("Creating and starting the " + serverName + " over port=" + backendAddress + " AND using '" + type + "'");
HttpSvrConfig httpSvrConfig = new HttpSvrConfig(serverName, backendAddress, 10000);
httpSvrConfig.asyncServerConfig.functionToConfigureBeforeBind = s -> configure(s);
SSLEngineFactory factory = (SSLEngineFactory) sslConfiguration.getBackendSslEngineFactory();
backendServer = serverMgr.createBackendHttpsServer(httpSvrConfig, serverListener, factory);
fut33 = backendServer.start();
return fut33;
}
Aggregations