Search in sources :

Example 11 with DataListener

use of org.webpieces.nio.api.handlers.DataListener in project webpieces by deanhiller.

the class AbstractHttp1Test method simulateClientConnecting.

private void simulateClientConnecting() throws InterruptedException, ExecutionException, TimeoutException {
    ConnectionListener listener = mockChanMgr.getSingleConnectionListener();
    CompletableFuture<DataListener> futureList = listener.connected(mockChannel, true);
    DataListener dataListener = futureList.get(3, TimeUnit.SECONDS);
    mockChannel.setDataListener(dataListener);
}
Also used : DataListener(org.webpieces.nio.api.handlers.DataListener) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener)

Example 12 with DataListener

use of org.webpieces.nio.api.handlers.DataListener in project webpieces by deanhiller.

the class Http11ClientSimulator method openHttp.

public Http11Socket openHttp() {
    ConnectionListener listener = mgr.getHttpConnection();
    MockTcpChannel channel = new MockTcpChannel(parser);
    CompletableFuture<DataListener> connected = listener.connected(channel, true);
    try {
        DataListener dataListener = connected.get(2, TimeUnit.SECONDS);
        return new Http11Socket(dataListener, channel, parser);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : DataListener(org.webpieces.nio.api.handlers.DataListener) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener)

Example 13 with DataListener

use of org.webpieces.nio.api.handlers.DataListener in project webpieces by deanhiller.

the class Http11ClientSimulator method openHttps.

public Http11Socket openHttps() {
    ConnectionListener listener = mgr.getHttpsConnection();
    MockTcpChannel channel = new MockTcpChannel(parser);
    CompletableFuture<DataListener> connected = listener.connected(channel, true);
    try {
        DataListener dataListener = connected.get(2, TimeUnit.SECONDS);
        return new Http11Socket(dataListener, channel, parser);
    } catch (Throwable e) {
        throw new RuntimeException(e);
    }
}
Also used : DataListener(org.webpieces.nio.api.handlers.DataListener) ConnectionListener(org.webpieces.nio.api.handlers.ConnectionListener)

Aggregations

DataListener (org.webpieces.nio.api.handlers.DataListener)13 InetSocketAddress (java.net.InetSocketAddress)5 ConnectionListener (org.webpieces.nio.api.handlers.ConnectionListener)5 Channel (org.webpieces.nio.api.channels.Channel)3 ByteBuffer (java.nio.ByteBuffer)2 Executor (java.util.concurrent.Executor)2 BufferCreationPool (org.webpieces.data.api.BufferCreationPool)2 BufferPool (org.webpieces.data.api.BufferPool)2 TCPChannel (org.webpieces.nio.api.channels.TCPChannel)2 NamedThreadFactory (org.webpieces.util.threading.NamedThreadFactory)2 CalledMethod (biz.xsoftware.mock.CalledMethod)1 Http2Config (com.webpieces.http2engine.api.client.Http2Config)1 InjectionConfig (com.webpieces.http2engine.api.client.InjectionConfig)1 IOException (java.io.IOException)1 PortUnreachableException (java.net.PortUnreachableException)1 SocketAddress (java.net.SocketAddress)1 NotYetConnectedException (java.nio.channels.NotYetConnectedException)1 ServerSocketChannel (java.nio.channels.ServerSocketChannel)1 SocketChannel (java.nio.channels.SocketChannel)1 Before (org.junit.Before)1