Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added libs/Java-WebSocket-1.3.7.jar
Binary file not shown.
Binary file removed libs/java-websocket-patch.jar
Binary file not shown.
16 changes: 13 additions & 3 deletions src/com/connectsdk/service/webos/WebOSTVMouseSocketConnection.java
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,13 @@

package com.connectsdk.service.webos;

import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.security.KeyException;
import java.security.NoSuchAlgorithmException;

import javax.net.ssl.SSLContext;

import org.java_websocket.WebSocket.READYSTATE;
import org.java_websocket.client.WebSocketClient;
Expand Down Expand Up @@ -95,14 +100,19 @@ public void onClose(int arg0, String arg1, boolean arg2) {
SSLContext sslContext = SSLContext.getInstance("TLS");
customTrustManager = new WebOSTVTrustManager();
sslContext.init(null, new WebOSTVTrustManager[] {customTrustManager}, null);
WebSocketClient.WebSocketClientFactory fac = new DefaultSSLWebSocketClientFactory(sslContext);
ws.setWebSocketFactory(fac);
//Web-Socket 1.3.7 patch
ws.setSocket(sslContext.getSocketFactory().createSocket());
ws.setConnectionLostTimeout(0);
} catch (KeyException e) {
e.printStackTrace();
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}

//patch ends
ws.connect();
}

Expand Down
19 changes: 13 additions & 6 deletions src/com/connectsdk/service/webos/WebOSTVServiceSocketClient.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.connectsdk.service.webos;

import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.net.URI;
import java.net.URISyntaxException;
Expand All @@ -10,17 +11,14 @@
import java.security.cert.CertificateException;
import java.security.cert.CertificateFactory;
import java.security.cert.X509Certificate;
import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;

import javax.net.ssl.SSLContext;
import javax.net.ssl.X509TrustManager;

import org.java_websocket.WebSocket;
import org.java_websocket.client.DefaultSSLWebSocketClientFactory;
import org.java_websocket.client.WebSocketClient;
import org.java_websocket.handshake.ServerHandshake;
import org.json.JSONArray;
Expand Down Expand Up @@ -678,14 +676,23 @@ else if (payloadType.equals("hello")) {
}

private void setSSLContext(SSLContext sslContext) {
setWebSocketFactory(new DefaultSSLWebSocketClientFactory(sslContext));
//Web-Socket 1.3.7 patch
try {
setSocket(sslContext.getSocketFactory().createSocket());
setConnectionLostTimeout(0);
} catch (IOException e) {
e.printStackTrace();
} catch (RuntimeException e) {
e.printStackTrace();
}
//patch ends
}

protected void setupSSL() {
try {
SSLContext sslContext = SSLContext.getInstance("TLS");
customTrustManager = new TrustManager();
sslContext.init(null, new TrustManager [] {customTrustManager}, null);
customTrustManager = new WebOSTVTrustManager();
sslContext.init(null, new WebOSTVTrustManager [] {customTrustManager}, null);
setSSLContext(sslContext);

if (!(mService.getServiceConfig() instanceof WebOSTVServiceConfig)) {
Expand Down