diff --git a/transport/src/main/java/io/netty/bootstrap/Bootstrap.java b/transport/src/main/java/io/netty/bootstrap/Bootstrap.java index b39654f69c..069ff44baa 100644 --- a/transport/src/main/java/io/netty/bootstrap/Bootstrap.java +++ b/transport/src/main/java/io/netty/bootstrap/Bootstrap.java @@ -99,7 +99,9 @@ public final class Bootstrap extends AbstractBootstrap { return promise; } - private static void doBind0(ChannelFuture initFuture, Channel channel, SocketAddress localAddress, ChannelPromise promise) { + private static void doBind0( + ChannelFuture initFuture, Channel channel, SocketAddress localAddress, ChannelPromise promise) { + if (initFuture.isSuccess()) { channel.bind(localAddress, promise).addListener(ChannelFutureListener.CLOSE_ON_FAILURE); } else {