-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSeparateProxies.java
More file actions
53 lines (44 loc) · 1.97 KB
/
SeparateProxies.java
File metadata and controls
53 lines (44 loc) · 1.97 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// java examples.general.SeparateProxies YOUR_TOKEN
//
// Раздельные прокси для форума и маркета + кастомные настройки.
package examples.general;
import com.lolzteam.LolzteamClient;
import com.lolzteam.models.*;
import java.time.Duration;
public class SeparateProxies {
public static void main(String[] args) throws Exception {
if (args.length < 1) {
System.err.println("Usage: SeparateProxies <TOKEN>");
System.exit(1);
}
String token = args[0];
// Раздельные прокси: форум через HTTP, маркет через SOCKS5
LolzteamClient client = LolzteamClient.builder(token)
.forumProxy("http://user:pass@proxy1.example.com:8080")
.marketProxy("socks5://proxy2.example.com:1080")
.maxRetries(3)
.timeout(Duration.ofSeconds(15))
.build();
System.out.println("--- forum via HTTP proxy ---");
try {
UsersGetResponse resp = client.forum().usersGet(1L, null);
User user = resp.getUser();
System.out.println("user: " + user.getUsername());
} catch (Exception e) {
System.err.println(" err: " + e.getMessage());
}
System.out.println("\n--- market via SOCKS5 proxy ---");
try {
ProfileGetResponse resp = client.market().profileGet(null);
System.out.println("profile: " + resp.getUser());
} catch (Exception e) {
System.err.println(" err: " + e.getMessage());
}
// Можно также задать кастомные base URL (для тестового окружения)
LolzteamClient testClient = LolzteamClient.builder(token)
.forumBaseUrl("https://test-api.lolz.live")
.marketBaseUrl("https://test-api.lzt.market")
.build();
System.out.println("\ndone");
}
}