Search in sources :

Example 11 with ConduitStreamSourceChannel

use of org.xnio.conduits.ConduitStreamSourceChannel in project wildfly by wildfly.

the class DistributableSessionManagerTestCase method createSessionResponseCommitted.

@Test
public void createSessionResponseCommitted() {
    // Ugh - all this, just to get HttpServerExchange.isResponseStarted() to return true
    Configurable configurable = mock(Configurable.class);
    StreamSourceConduit sourceConduit = mock(StreamSourceConduit.class);
    ConduitStreamSourceChannel sourceChannel = new ConduitStreamSourceChannel(configurable, sourceConduit);
    StreamSinkConduit sinkConduit = mock(StreamSinkConduit.class);
    ConduitStreamSinkChannel sinkChannel = new ConduitStreamSinkChannel(configurable, sinkConduit);
    StreamConnection stream = mock(StreamConnection.class);
    when(stream.getSourceChannel()).thenReturn(sourceChannel);
    when(stream.getSinkChannel()).thenReturn(sinkChannel);
    ByteBufferPool bufferPool = mock(ByteBufferPool.class);
    HttpHandler handler = mock(HttpHandler.class);
    HttpServerConnection connection = new HttpServerConnection(stream, bufferPool, handler, OptionMap.create(UndertowOptions.ALWAYS_SET_DATE, false), 0, null);
    HttpServerExchange exchange = new HttpServerExchange(connection);
    exchange.setProtocol(Protocols.HTTP_1_1);
    exchange.getResponseChannel();
    SessionConfig config = mock(SessionConfig.class);
    Assert.assertThrows(IllegalStateException.class, () -> this.adapter.createSession(exchange, config));
}
Also used : ByteBufferPool(io.undertow.connector.ByteBufferPool) HttpServerExchange(io.undertow.server.HttpServerExchange) HttpHandler(io.undertow.server.HttpHandler) HttpServerConnection(io.undertow.server.protocol.http.HttpServerConnection) StreamSinkConduit(org.xnio.conduits.StreamSinkConduit) SessionConfig(io.undertow.server.session.SessionConfig) Configurable(org.xnio.channels.Configurable) ConduitStreamSourceChannel(org.xnio.conduits.ConduitStreamSourceChannel) StreamConnection(org.xnio.StreamConnection) StreamSourceConduit(org.xnio.conduits.StreamSourceConduit) ConduitStreamSinkChannel(org.xnio.conduits.ConduitStreamSinkChannel) Test(org.junit.Test)

Example 12 with ConduitStreamSourceChannel

use of org.xnio.conduits.ConduitStreamSourceChannel in project undertow by undertow-io.

the class AjpReadListener method exchangeComplete.

public void exchangeComplete(final HttpServerExchange exchange) {
    if (!exchange.isUpgrade() && exchange.isPersistent()) {
        startRequest();
        ConduitStreamSourceChannel channel = ((AjpServerConnection) exchange.getConnection()).getChannel().getSourceChannel();
        channel.getReadSetter().set(this);
        channel.wakeupReads();
    } else if (!exchange.isPersistent()) {
        safeClose(exchange.getConnection());
    }
}
Also used : ConduitStreamSourceChannel(org.xnio.conduits.ConduitStreamSourceChannel)

Aggregations

ConduitStreamSourceChannel (org.xnio.conduits.ConduitStreamSourceChannel)12 ConduitStreamSinkChannel (org.xnio.conduits.ConduitStreamSinkChannel)5 IOException (java.io.IOException)4 StreamConnection (org.xnio.StreamConnection)4 StreamSourceConduit (org.xnio.conduits.StreamSourceConduit)4 HttpString (io.undertow.util.HttpString)3 StreamSinkConduit (org.xnio.conduits.StreamSinkConduit)3 ByteBufferPool (io.undertow.connector.ByteBufferPool)2 HttpHandler (io.undertow.server.HttpHandler)2 HttpServerExchange (io.undertow.server.HttpServerExchange)2 HttpServerConnection (io.undertow.server.protocol.http.HttpServerConnection)2 SessionConfig (io.undertow.server.session.SessionConfig)2 ByteBuffer (java.nio.ByteBuffer)2 Configurable (org.xnio.channels.Configurable)2 ClientRequest (io.undertow.client.ClientRequest)1 BytesSentStreamSinkConduit (io.undertow.conduits.BytesSentStreamSinkConduit)1 ChunkedStreamSinkConduit (io.undertow.conduits.ChunkedStreamSinkConduit)1 ChunkedStreamSourceConduit (io.undertow.conduits.ChunkedStreamSourceConduit)1 EmptyStreamSourceConduit (io.undertow.conduits.EmptyStreamSourceConduit)1 WriteTimeoutStreamSinkConduit (io.undertow.conduits.WriteTimeoutStreamSinkConduit)1