/** * Writes one message to the outbound of this {@link Channel} and does not flush it. This * method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. * * @see #writeOneInbound(Object, ChannelPromise) */ public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
/** * Writes one message to the outbound of this {@link Channel} and does not flush it. This * method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. * * @see #writeOneInbound(Object, ChannelPromise) */ public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
/** * Writes one message to the outbound of this {@link Channel} and does not flush it. This * method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. * * @see #writeOneInbound(Object, ChannelPromise) */ public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
public void sendMessages(int msgCount) { for(int i=0; i < msgCount; i++) { channel.write("Hello"); } channel.flush(); }
@Test(timeout = 60000) public void testFlush() throws Exception { String msg = "Hello"; channelOpRule.channel.write(Unpooled.buffer().writeBytes(msg.getBytes())); channelOpRule.channelOperations.flush(); channelOpRule.verifyOutboundMessages(msg); }
public void sendMessages(WriteStreamSubscriber subscriber, int msgCount) { for(int i=0; i < msgCount; i++) { subscriber.onNext("Hello"); channel.write("Hello"); } channel.flush(); }
@Test(timeout = 60000) public void testCloseWithoutFlush() throws Exception { TestSubscriber<Void> subscriber = new TestSubscriber<>(); channelOpRule.channel.write("Hello"); channelOpRule.channelOperations.close(false).subscribe(subscriber); subscriber.assertTerminalEvent(); subscriber.assertNoErrors(); channelOpRule.verifyOutboundMessages(); assertThat("Channel not closed.", channelOpRule.channel.isOpen(), is(false)); }
break; futures.add(write(m));
@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())); }
break; futures.add(write(m));
break; futures.add(write(m));
/** * Writes one message to the outbound of this {@link Channel} and does not flush it. This * method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. * * @see #writeOneInbound(Object, ChannelPromise) */ public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
/** * Writes one message to the outbound of this {@link Channel} and does not flush it. This * method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. * * @see #writeOneInbound(Object, ChannelPromise) */ public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
/** * Writes one message to the outbound of this {@link Channel} and does not flush it. This * method is conceptually equivalent to {@link #write(Object, ChannelPromise)}. * * @see #writeOneInbound(Object, ChannelPromise) */ public ChannelFuture writeOneOutbound(Object msg, ChannelPromise promise) { if (checkOpen(true)) { return write(msg, promise); } return checkException(promise); }
break; futures.add(write(m));
break; futures.add(write(m));
break; futures.add(write(m));