File tree Expand file tree Collapse file tree 2 files changed +14
-8
lines changed
dslink-v2-websocket/src/main/java/org/iot/dsa/dslink/websocket Expand file tree Collapse file tree 2 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -101,10 +101,13 @@ public DSTransport open() {
101101 }
102102 client .setDefaultMaxBinaryMessageBufferSize (64 * 1024 );
103103 client .setDefaultMaxTextMessageBufferSize (64 * 1024 );
104- SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator (new SslContextConfigurator ());
105- sslEngineConfigurator .setHostnameVerifier (SysCertManager .getInstance ().getHostnameVerifier ());
106- client .getProperties ().put (ClientProperties .SSL_ENGINE_CONFIGURATOR , sslEngineConfigurator );
107- client .connectToServer (this , new URI (getConnectionUrl ()));
104+ URI connUri = new URI (getConnectionUrl ());
105+ if ("wss" .equalsIgnoreCase (connUri .getScheme ())) {
106+ SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator (new SslContextConfigurator ());
107+ sslEngineConfigurator .setHostnameVerifier (SysCertManager .getInstance ().getHostnameVerifier ());
108+ client .getProperties ().put (ClientProperties .SSL_ENGINE_CONFIGURATOR , sslEngineConfigurator );
109+ }
110+ client .connectToServer (this , connUri );
108111 debug (debug () ? "Transport open" : null );
109112 } catch (Exception x ) {
110113 DSException .throwRuntime (x );
Original file line number Diff line number Diff line change @@ -153,10 +153,13 @@ public DSTransport open() {
153153 }
154154 client .setDefaultMaxBinaryMessageBufferSize (64 * 1024 );
155155 client .setDefaultMaxTextMessageBufferSize (64 * 1024 );
156- SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator (new SslContextConfigurator ());
157- sslEngineConfigurator .setHostnameVerifier (SysCertManager .getInstance ().getHostnameVerifier ());
158- client .getProperties ().put (ClientProperties .SSL_ENGINE_CONFIGURATOR , sslEngineConfigurator );
159- client .connectToServer (this , new URI (getConnectionUrl ()));
156+ URI connUri = new URI (getConnectionUrl ());
157+ if ("wss" .equalsIgnoreCase (connUri .getScheme ())) {
158+ SslEngineConfigurator sslEngineConfigurator = new SslEngineConfigurator (new SslContextConfigurator ());
159+ sslEngineConfigurator .setHostnameVerifier (SysCertManager .getInstance ().getHostnameVerifier ());
160+ client .getProperties ().put (ClientProperties .SSL_ENGINE_CONFIGURATOR , sslEngineConfigurator );
161+ }
162+ client .connectToServer (this , connUri );
160163 } catch (Exception x ) {
161164 DSException .throwRuntime (x );
162165 }
You can’t perform that action at this time.
0 commit comments