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));
}
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());
}
}
Aggregations