private void flushOutbound0() { // We need to call runPendingTasks first as a ChannelOutboundHandler may used eventloop.execute(...) to // delay the write on the next eventloop run. runPendingTasks(); flush(); }
private void flushOutbound0() { // We need to call runPendingTasks first as a ChannelOutboundHandler may used eventloop.execute(...) to // delay the write on the next eventloop run. runPendingTasks(); flush(); }
private void flushOutbound0() { // We need to call runPendingTasks first as a ChannelOutboundHandler may used eventloop.execute(...) to // delay the write on the next eventloop run. runPendingTasks(); flush(); }
public void writeAndFlushMessages(Object... msgs) { writeMessages(msgs); channel.flush(); }
public void sendMessages(int msgCount) { for(int i=0; i < msgCount; i++) { channel.write("Hello"); } channel.flush(); }
public void sendMessages(WriteStreamSubscriber subscriber, int msgCount) { for(int i=0; i < msgCount; i++) { subscriber.onNext("Hello"); channel.write("Hello"); } channel.flush(); }
public Queue<Object> getWrittenMessages() { channel.runPendingTasks(); channel.flush(); return channel.outboundMessages(); }
public static void assertConnAckAccepted(EmbeddedChannel channel) { channel.flush(); assertEqualsConnAck(CONNECTION_ACCEPTED, channel.readOutbound()); }
@Test(timeout = 60000) public void testWriteCompleteAfterStream() throws Exception { subscriberRule.start(); String msg1 = "msg1"; subscriberRule.writeMessages(msg1); assertThat("Unexpected promise completion state.", subscriberRule.channelPromise.isDone(), is(false)); subscriberRule.subscriber.onCompleted(); /*Complete when write completes.*/ assertThat("Unexpected promise completion state.", subscriberRule.channelPromise.isDone(), is(false)); subscriberRule.channel.flush(); /*Completes write*/ subscriberRule.assertMessagesWritten(msg1); assertThat("Unexpected promise completion state.", subscriberRule.channelPromise.isDone(), is(true)); assertThat("Unexpected promise result.", subscriberRule.channelPromise.isSuccess(), is(true)); }
@Test(timeout = 60000) public void testMultiWrite() throws Exception { subscriberRule.start(); String msg1 = "msg1"; String msg2 = "msg2"; subscriberRule.writeMessages(msg1, msg2); assertThat("Unexpected promise completion state.", subscriberRule.channelPromise.isDone(), is(false)); subscriberRule.subscriber.onCompleted(); /*Complete when write completes.*/ assertThat("Unexpected promise completion state.", subscriberRule.channelPromise.isDone(), is(false)); subscriberRule.channel.flush(); /*Completes write*/ subscriberRule.assertMessagesWritten(msg1, msg2); assertThat("Unexpected promise completion state.", subscriberRule.channelPromise.isDone(), is(true)); assertThat("Unexpected promise result.", subscriberRule.channelPromise.isSuccess(), is(true)); }
@Test(timeout = 60000) public void testRequestMorePostFlush() throws Exception { WriteStreamSubscriber sub1 = inspectorRule.newSubscriber(); MockProducer mockProducer = inspectorRule.setupSubscriberAndValidate(sub1, 1); assertThat("Unexpected items requested from producer.", mockProducer.getRequested(), is(defaultRequestN())); inspectorRule.channel.config().setWriteBufferWaterMark(new WriteBufferWaterMark(1, 2)); /*Make sure that the channel is not writable on writing.*/ String msg = "Hello"; inspectorRule.channel.write(msg); assertThat("Channel still writable.", inspectorRule.channel.isWritable(), is(false)); assertThat("More items requested when channel is not writable.", mockProducer.getRequested(), is(defaultRequestN())); inspectorRule.channel.flush(); assertThat("Channel not writable post flush.", inspectorRule.channel.isWritable(), is(true)); assertThat("Unexpected items requested.", mockProducer.getRequested(), is(defaultRequestN())); }
private void flushOutbound0() { // We need to call runPendingTasks first as a ChannelOutboundHandler may used eventloop.execute(...) to // delay the write on the next eventloop run. runPendingTasks(); flush(); }
private void flushOutbound0() { // We need to call runPendingTasks first as a ChannelOutboundHandler may used eventloop.execute(...) to // delay the write on the next eventloop run. runPendingTasks(); flush(); }
private void flushOutbound0() { // We need to call runPendingTasks first as a ChannelOutboundHandler may used eventloop.execute(...) to // delay the write on the next eventloop run. runPendingTasks(); flush(); }