Java Code Examples for io.netty.channel.DefaultChannelPromise#setSuccess()

The following examples show how to use io.netty.channel.DefaultChannelPromise#setSuccess() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SmtpSessionTest.java    From NioSmtpClient with Apache License 2.0 5 votes vote down vote up
@Test
public void itClosesTheUnderlyingChannel() {
  DefaultChannelPromise channelPromise = new DefaultChannelPromise(channel, ImmediateEventExecutor.INSTANCE);
  when(channel.close()).thenReturn(channelPromise);

  CompletableFuture<Void> f = session.close();
  channelPromise.setSuccess();

  assertThat(f.isDone());
}
 
Example 2
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture bind(SocketAddress localAddress) {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}
 
Example 3
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture connect(SocketAddress remoteAddress) {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}
 
Example 4
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture connect(SocketAddress remoteAddress, SocketAddress localAddress) {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}
 
Example 5
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture disconnect() {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}
 
Example 6
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture close() {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}
 
Example 7
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture deregister() {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}
 
Example 8
Source File: MockChannelHandlerContext.java    From karyon with Apache License 2.0 4 votes vote down vote up
@Override
public ChannelFuture write(Object msg) {
    DefaultChannelPromise promise = new DefaultChannelPromise(channel);
    promise.setSuccess();
    return promise;
}