File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
autobahn/src/main/java/io/crossbar/autobahn/wamp Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -127,7 +127,7 @@ public CompletableFuture<ExitInfo> connect(TransportOptions options) {
127127 try {
128128 mTransports .get (0 ).connect (mSession , options );
129129 } catch (Exception e ) {
130- throw new CompletionException (e );
130+ exitFuture . completeExceptionally (e );
131131 }
132132 }, getExecutor ());
133133 return exitFuture ;
Original file line number Diff line number Diff line change 3131import io .netty .buffer .ByteBuf ;
3232import io .netty .buffer .Unpooled ;
3333import io .netty .channel .Channel ;
34+ import io .netty .channel .ChannelFuture ;
35+ import io .netty .channel .ChannelFutureListener ;
3436import io .netty .channel .ChannelInitializer ;
3537import io .netty .channel .ChannelPipeline ;
3638import io .netty .channel .EventLoopGroup ;
@@ -178,9 +180,15 @@ protected void initChannel(SocketChannel ch) throws Exception {
178180 mHandler );
179181 }
180182 });
181-
182- mChannel = bootstrap .connect (uri .getHost (), port ).sync ().channel ();
183- mHandler .getHandshakeFuture ().sync ();
183+ ChannelFuture f = bootstrap .connect (uri .getHost (), port );
184+ f .addListener ((ChannelFutureListener ) connectFuture -> {
185+ Throwable connectCause = connectFuture .cause ();
186+ if (connectCause != null ) {
187+ transportHandler .onDisconnect (false );
188+ } else {
189+ mChannel = f .channel ();
190+ }
191+ });
184192 }
185193
186194 @ Override
You can’t perform that action at this time.
0 commit comments