Skip to content

Commit dbdc155

Browse files
author
Julio Zynger
committed
Adding hack for HTTPS. More research is needed on this after release. @erikwolfe02
1 parent 13762a3 commit dbdc155

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

src/io/socket/WebsocketTransport.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import java.io.IOException;
44
import java.net.URI;
55
import java.net.URL;
6+
import java.security.KeyManagementException;
7+
import java.security.NoSuchAlgorithmException;
8+
import java.security.NoSuchProviderException;
69
import java.util.regex.Pattern;
710

811
import javax.net.ssl.SSLContext;
@@ -28,12 +31,25 @@ public static IOTransport create(URL url, IOConnection connection) {
2831
public WebsocketTransport(URI uri, IOConnection connection) {
2932
super(uri);
3033
this.connection = connection;
31-
SSLContext context = IOConnection.getSslContext();
34+
SSLContext context = null;
35+
try {
36+
context = SSLContext.getInstance("TLS", "HarmonyJSSE");
37+
} catch (NoSuchAlgorithmException e) {
38+
e.printStackTrace();
39+
} catch (NoSuchProviderException e) {
40+
e.printStackTrace();
41+
}
42+
try {
43+
context.init(null, null, null);
44+
} catch (KeyManagementException e) {
45+
e.printStackTrace();
46+
}
3247
if("wss".equals(uri.getScheme()) && context != null) {
33-
this.setWebSocketFactory(new DefaultSSLWebSocketClientFactory(context));
48+
this.setWebSocketFactory(new DefaultSSLWebSocketClientFactory(context));
3449
}
3550
}
3651

52+
3753
/* (non-Javadoc)
3854
* @see io.socket.IOTransport#disconnect()
3955
*/

0 commit comments

Comments
 (0)