Moved proxy declaration to inside of try, updated websocket version to 1.5.5 from 1.5.4, and cleared up ProxyExample!

This commit is contained in:
kohlerpop1
2024-01-16 22:09:56 -05:00
parent 9da96b4417
commit 2555edd86f
3 changed files with 5 additions and 4 deletions

View File

@@ -39,7 +39,7 @@
<dependency>
<groupId>org.java-websocket</groupId>
<artifactId>Java-WebSocket</artifactId>
<version>1.5.4</version>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>

View File

@@ -22,7 +22,6 @@
*/
package io.github.jwdeveloper.tiktok.websocket;
import io.github.jwdeveloper.tiktok.*;
import io.github.jwdeveloper.tiktok.data.dto.ProxyData;
import io.github.jwdeveloper.tiktok.data.requests.LiveConnectionData;
@@ -105,7 +104,6 @@ public class TikTokWebSocketClient implements SocketClient {
}
public boolean tryProxyConnection(ProxyClientSettings proxySettings, ProxyData proxyData) {
webSocketClient.setProxy(new Proxy(proxySettings.getType(), proxyData.toSocketAddress()));
try {
if (proxySettings.getType() == Proxy.Type.SOCKS) {
SSLContext sc = SSLContext.getInstance("SSL");
@@ -116,6 +114,7 @@ public class TikTokWebSocketClient implements SocketClient {
}}, null);
webSocketClient.setSocketFactory(sc.getSocketFactory());
}
webSocketClient.setProxy(new Proxy(proxySettings.getType(), proxyData.toSocketAddress()));
webSocketClient.connect();
return true;
} catch (Exception e)