Search in sources :

Example 6 with MockStreamWriter

use of org.webpieces.httpfrontend2.api.mock2.MockStreamWriter 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);
}
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) 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)

Example 7 with MockStreamWriter

use of org.webpieces.httpfrontend2.api.mock2.MockStreamWriter 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();
}
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)

Aggregations

Http2Request (com.webpieces.hpack.api.dto.Http2Request)4 Test (org.junit.Test)4 PassedIn (org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.PassedIn)4 MockStreamWriter (org.webpieces.httpfrontend2.api.mock2.MockStreamWriter)4 Http2Response (com.webpieces.hpack.api.dto.Http2Response)3 StreamWriter (com.webpieces.http2engine.api.StreamWriter)3 Http2Config (com.webpieces.http2engine.api.client.Http2Config)3 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)3 InetSocketAddress (java.net.InetSocketAddress)3 Before (org.junit.Before)3 FrontendConfig (org.webpieces.frontend2.api.FrontendConfig)3 HttpFrontendManager (org.webpieces.frontend2.api.HttpFrontendManager)3 HttpServer (org.webpieces.frontend2.api.HttpServer)3 MockTcpServerChannel (org.webpieces.httpfrontend2.api.mock2.MockTcpServerChannel)3 DataFrame (com.webpieces.http2parser.api.dto.DataFrame)2 Http2Msg (com.webpieces.http2parser.api.dto.lib.Http2Msg)2 Http2Headers (com.webpieces.hpack.api.dto.Http2Headers)1 Http2Trailers (com.webpieces.hpack.api.dto.Http2Trailers)1 Cancel (org.webpieces.httpfrontend2.api.mock2.MockHttp2RequestListener.Cancel)1 ConnectionListener (org.webpieces.nio.api.handlers.ConnectionListener)1