use of org.webpieces.frontend2.api.FrontendConfig in project webpieces by deanhiller.
the class ServerFactory method createTestServer.
static int createTestServer(boolean alwaysHttp2, Long maxConcurrentStreams) {
BufferCreationPool pool = new BufferCreationPool();
ScheduledExecutorService timer = new ScheduledThreadPoolExecutor(1, new NamedThreadFactory("webpieces-timer"));
HttpFrontendManager frontEndMgr = HttpFrontendFactory.createFrontEnd("frontEnd", 10, timer, pool);
FrontendConfig config = new FrontendConfig("id2", new InetSocketAddress(0));
HttpServer server = frontEndMgr.createHttpServer(config, new OurListener());
server.start();
return server.getUnderlyingChannel().getLocalAddress().getPort();
}
use of org.webpieces.frontend2.api.FrontendConfig in project webpieces by deanhiller.
the class AbstractHttp2Test method setUp.
@Before
public void setUp() throws InterruptedException, ExecutionException, TimeoutException {
MockTcpServerChannel svrChannel = new MockTcpServerChannel();
mockChanMgr.addTCPSvrChannelToReturn(svrChannel);
mockTcpChannel.setIncomingFrameDefaultReturnValue(CompletableFuture.completedFuture(mockTcpChannel));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
FrontendConfig frontendConfig = new FrontendConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
simulateClientConnecting();
simulateClientSendingPrefaceAndSettings();
}
use of org.webpieces.frontend2.api.FrontendConfig 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(CompletableFuture.completedFuture(mockTcpChannel));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
FrontendConfig frontendConfig = new FrontendConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
CompletableFuture<DataListener> futureList = listener.connected(mockTcpChannel, true);
DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
mockChannel.setDataListener(dataListener);
}
use of org.webpieces.frontend2.api.FrontendConfig 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(CompletableFuture.completedFuture(mockChannel));
mockListener.setDefaultRetVal(mockStreamWriter);
mockStreamWriter.setDefaultRetValToThis();
Http2Config config = new Http2Config();
config.setLocalSettings(localSettings);
InjectionConfig injConfig = new InjectionConfig(mockTime, config);
FrontendConfig frontendConfig = new FrontendConfig("http", new InetSocketAddress("me", 8080));
HttpFrontendManager manager = HttpFrontendFactory.createFrontEnd(mockChanMgr, mockTimer, injConfig);
HttpServer httpServer = manager.createHttpServer(frontendConfig, mockListener);
httpServer.start();
simulateClientConnecting();
}
use of org.webpieces.frontend2.api.FrontendConfig in project webpieces by deanhiller.
the class WebServerImpl method start.
@Override
public StreamListener start() {
log.info("starting server");
routingService.start();
//validate html route id's and params on startup if 'org.webpieces.routeId.txt' exists
validateRouteIdsFromHtmlFiles();
FrontendConfig svrChanConfig = new FrontendConfig("http", config.getHttpListenAddress());
svrChanConfig.asyncServerConfig.functionToConfigureBeforeBind = config.getFunctionToConfigureServerSocket();
httpServer = serverMgr.createHttpServer(svrChanConfig, serverListener);
httpServer.start();
if (factory != null) {
FrontendConfig secureChanConfig = new FrontendConfig("https", config.getHttpsListenAddress(), 10000);
secureChanConfig.asyncServerConfig.functionToConfigureBeforeBind = config.getFunctionToConfigureServerSocket();
httpsServer = serverMgr.createHttpsServer(secureChanConfig, serverListener, factory);
httpsServer.start();
} else {
log.info("https port is disabled since configuration had no sslEngineFactory");
}
log.info("server started");
return serverListener;
}
Aggregations