mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-12-23 09:01:08 +03:00
[FIX] Возможный фикс проблемы с web socket secure
This commit is contained in:
parent
f2e68c9f62
commit
686ffa6371
1 changed files with 3 additions and 3 deletions
|
@ -27,6 +27,7 @@ public abstract class ClientJSONPoint {
|
|||
private static final EventLoopGroup group = new NioEventLoopGroup();
|
||||
protected WebSocketClientHandler webSocketClientHandler;
|
||||
protected Bootstrap bootstrap = new Bootstrap();
|
||||
protected boolean ssl = false;
|
||||
public boolean isClosed;
|
||||
|
||||
public ClientJSONPoint(final String uri) throws SSLException {
|
||||
|
@ -39,7 +40,6 @@ public ClientJSONPoint(URI uri) throws SSLException {
|
|||
if (!"ws".equals(protocol) && !"wss".equals(protocol)) {
|
||||
throw new IllegalArgumentException("Unsupported protocol: " + protocol);
|
||||
}
|
||||
boolean ssl = false;
|
||||
if("wss".equals(protocol))
|
||||
{
|
||||
ssl = true;
|
||||
|
@ -55,7 +55,7 @@ public ClientJSONPoint(URI uri) throws SSLException {
|
|||
public void initChannel(SocketChannel ch) throws Exception {
|
||||
ChannelPipeline pipeline = ch.pipeline();
|
||||
if (sslCtx != null) {
|
||||
pipeline.addLast(sslCtx.newHandler(ch.alloc()));
|
||||
pipeline.addLast(sslCtx.newHandler(ch.alloc(), uri.getHost(), 443));
|
||||
}
|
||||
pipeline.addLast("http-codec", new HttpClientCodec());
|
||||
pipeline.addLast("aggregator", new HttpObjectAggregator(65536));
|
||||
|
@ -70,7 +70,7 @@ public void open() throws Exception {
|
|||
new WebSocketClientHandler(
|
||||
WebSocketClientHandshakerFactory.newHandshaker(
|
||||
uri, WebSocketVersion.V13, null, false, EmptyHttpHeaders.INSTANCE, 1280000), this);
|
||||
ch = bootstrap.connect(uri.getHost(), uri.getPort()).sync().channel();
|
||||
ch = bootstrap.connect(uri.getHost(), ssl ? 443 : uri.getPort()).sync().channel();
|
||||
webSocketClientHandler.handshakeFuture().sync();
|
||||
}
|
||||
public ChannelFuture send(String text)
|
||||
|
|
Loading…
Reference in a new issue