[#735] Make sure the handshake ChannelFuture is notified after the right encoder is present in the ChannelPipeline
This commit is contained in:
parent
d177fd5a17
commit
efaa5c2ff5
@ -19,6 +19,7 @@ import io.netty.buffer.Unpooled;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
|
import io.netty.channel.ChannelFutureNotifier;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.handler.codec.http.DefaultHttpRequest;
|
import io.netty.handler.codec.http.DefaultHttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpHeaders.Names;
|
import io.netty.handler.codec.http.HttpHeaders.Names;
|
||||||
@ -172,6 +173,7 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
|
|||||||
|
|
||||||
request.setContent(Unpooled.copiedBuffer(key3));
|
request.setContent(Unpooled.copiedBuffer(key3));
|
||||||
|
|
||||||
|
ChannelFuture handshakeFuture = channel.newFuture();
|
||||||
ChannelFuture future = channel.write(request);
|
ChannelFuture future = channel.write(request);
|
||||||
|
|
||||||
future.addListener(new ChannelFutureListener() {
|
future.addListener(new ChannelFutureListener() {
|
||||||
@ -183,8 +185,9 @@ public class WebSocketClientHandshaker00 extends WebSocketClientHandshaker {
|
|||||||
"ws-encoder", new WebSocket00FrameEncoder());
|
"ws-encoder", new WebSocket00FrameEncoder());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
future.addListener(new ChannelFutureNotifier(handshakeFuture));
|
||||||
|
|
||||||
return future;
|
return handshakeFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ package io.netty.handler.codec.http.websocketx;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
|
import io.netty.channel.ChannelFutureNotifier;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.handler.codec.http.DefaultHttpRequest;
|
import io.netty.handler.codec.http.DefaultHttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpHeaders.Names;
|
import io.netty.handler.codec.http.HttpHeaders.Names;
|
||||||
@ -151,6 +152,7 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelFuture handshakeFuture = channel.newFuture();
|
||||||
ChannelFuture future = channel.write(request);
|
ChannelFuture future = channel.write(request);
|
||||||
|
|
||||||
future.addListener(new ChannelFutureListener() {
|
future.addListener(new ChannelFutureListener() {
|
||||||
@ -162,8 +164,9 @@ public class WebSocketClientHandshaker08 extends WebSocketClientHandshaker {
|
|||||||
"ws-encoder", new WebSocket08FrameEncoder(true));
|
"ws-encoder", new WebSocket08FrameEncoder(true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
future.addListener(new ChannelFutureNotifier(handshakeFuture));
|
||||||
|
|
||||||
return future;
|
return handshakeFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -18,6 +18,7 @@ package io.netty.handler.codec.http.websocketx;
|
|||||||
import io.netty.channel.Channel;
|
import io.netty.channel.Channel;
|
||||||
import io.netty.channel.ChannelFuture;
|
import io.netty.channel.ChannelFuture;
|
||||||
import io.netty.channel.ChannelFutureListener;
|
import io.netty.channel.ChannelFutureListener;
|
||||||
|
import io.netty.channel.ChannelFutureNotifier;
|
||||||
import io.netty.channel.ChannelPipeline;
|
import io.netty.channel.ChannelPipeline;
|
||||||
import io.netty.handler.codec.http.DefaultHttpRequest;
|
import io.netty.handler.codec.http.DefaultHttpRequest;
|
||||||
import io.netty.handler.codec.http.HttpHeaders.Names;
|
import io.netty.handler.codec.http.HttpHeaders.Names;
|
||||||
@ -151,6 +152,7 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ChannelFuture handshakeFuture = channel.newFuture();
|
||||||
ChannelFuture future = channel.write(request);
|
ChannelFuture future = channel.write(request);
|
||||||
|
|
||||||
future.addListener(new ChannelFutureListener() {
|
future.addListener(new ChannelFutureListener() {
|
||||||
@ -162,8 +164,8 @@ public class WebSocketClientHandshaker13 extends WebSocketClientHandshaker {
|
|||||||
"ws-encoder", new WebSocket13FrameEncoder(true));
|
"ws-encoder", new WebSocket13FrameEncoder(true));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
future.addListener(new ChannelFutureNotifier(handshakeFuture));
|
||||||
return future;
|
return handshakeFuture;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user