From 686ffa63717cfde2d87ec192244f24cdeef4f44d Mon Sep 17 00:00:00 2001 From: Gravit Date: Tue, 7 May 2019 23:35:36 +0700 Subject: [PATCH] =?UTF-8?q?[FIX]=20=D0=92=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6?= =?UTF-8?q?=D0=BD=D1=8B=D0=B9=20=D1=84=D0=B8=D0=BA=D1=81=20=D0=BF=D1=80?= =?UTF-8?q?=D0=BE=D0=B1=D0=BB=D0=B5=D0=BC=D1=8B=20=D1=81=20web=20socket=20?= =?UTF-8?q?secure?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../gravit/launcher/request/websockets/ClientJSONPoint.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/ClientJSONPoint.java b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/ClientJSONPoint.java index 22e0c07d..0f5441c7 100644 --- a/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/ClientJSONPoint.java +++ b/LauncherAPI/src/main/java/ru/gravit/launcher/request/websockets/ClientJSONPoint.java @@ -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)