Search in sources :

Example 1 with MockTcpServerChannel

use of org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel 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();
}
Also used : FrontendConfig(org.webpieces.frontend2.api.FrontendConfig) HttpFrontendManager(org.webpieces.frontend2.api.HttpFrontendManager) InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) HttpServer(org.webpieces.frontend2.api.HttpServer) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) MockTcpServerChannel(org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel) Before(org.junit.Before)

Example 2 with MockTcpServerChannel

use of org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel in project webpieces by deanhiller.

the class AbstractFrontendHttp2Test 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();
    simulateClientConnecting();
    simulateClientSendingPrefaceAndSettings();
}
Also used : HttpFrontendManager(org.webpieces.frontend2.api.HttpFrontendManager) InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) HttpServer(org.webpieces.frontend2.api.HttpServer) HttpSvrConfig(org.webpieces.frontend2.api.HttpSvrConfig) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) MockTcpServerChannel(org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel) Before(org.junit.Before)

Example 3 with MockTcpServerChannel

use of org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel 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();
}
Also used : HttpFrontendManager(org.webpieces.frontend2.api.HttpFrontendManager) InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) HttpServer(org.webpieces.frontend2.api.HttpServer) HttpSvrConfig(org.webpieces.frontend2.api.HttpSvrConfig) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) MockTcpServerChannel(org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel) Before(org.junit.Before)

Example 4 with MockTcpServerChannel

use of org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel 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);
}
Also used : HttpFrontendManager(org.webpieces.frontend2.api.HttpFrontendManager) InetSocketAddress(java.net.InetSocketAddress) Http2Config(com.webpieces.http2engine.api.client.Http2Config) SimpleMeterRegistry(io.micrometer.core.instrument.simple.SimpleMeterRegistry) HttpServer(org.webpieces.frontend2.api.HttpServer) HttpSvrConfig(org.webpieces.frontend2.api.HttpSvrConfig) InjectionConfig(com.webpieces.http2engine.api.client.InjectionConfig) DataListener(org.webpieces.nio.api.handlers.DataListener) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener) MockTcpServerChannel(org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel) Before(org.junit.Before)

Aggregations

Http2Config (com.webpieces.http2engine.api.client.Http2Config)4 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)4 InetSocketAddress (java.net.InetSocketAddress)4 Before (org.junit.Before)4 HttpFrontendManager (org.webpieces.frontend2.api.HttpFrontendManager)4 HttpServer (org.webpieces.frontend2.api.HttpServer)4 MockTcpServerChannel (org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel)4 SimpleMeterRegistry (io.micrometer.core.instrument.simple.SimpleMeterRegistry)3 HttpSvrConfig (org.webpieces.frontend2.api.HttpSvrConfig)3 FrontendConfig (org.webpieces.frontend2.api.FrontendConfig)1 ConnectionListener (org.webpieces.nio.api.handlers.ConnectionListener)1 DataListener (org.webpieces.nio.api.handlers.DataListener)1