@@ -53,6 +53,7 @@ public enum ProxyType {
53
53
private String noProxy ;
54
54
private String sslProxy ;
55
55
private String socksProxy ;
56
+ private String socksVersion ;
56
57
private String socksUsername ;
57
58
private String socksPassword ;
58
59
private String proxyAutoconfigUrl ;
@@ -80,6 +81,9 @@ public Proxy(Map<String, ?> raw) {
80
81
if (raw .containsKey ("socksProxy" ) && raw .get ("socksProxy" ) != null ) {
81
82
setSocksProxy ((String ) raw .get ("socksProxy" ));
82
83
}
84
+ if (raw .containsKey ("socksVersion" ) && raw .get ("socksVersion" ) != null ) {
85
+ setSocksProxy ((String ) raw .get ("socksVersion" ));
86
+ }
83
87
if (raw .containsKey ("socksUsername" ) && raw .get ("socksUsername" ) != null ) {
84
88
setSocksUsername ((String ) raw .get ("socksUsername" ));
85
89
}
@@ -115,6 +119,9 @@ public Map<String, Object> toJson() {
115
119
if (socksProxy != null ) {
116
120
m .put ("socksProxy" , socksProxy );
117
121
}
122
+ if (socksVersion != null ) {
123
+ m .put ("socksProxyVersion" , socksVersion );
124
+ }
118
125
if (socksUsername != null ) {
119
126
m .put ("socksUsername" , socksUsername );
120
127
}
@@ -293,6 +300,28 @@ public Proxy setSocksProxy(String socksProxy) {
293
300
return this ;
294
301
}
295
302
303
+ /**
304
+ * Gets the SOCKS version (4 or 5).
305
+ *
306
+ * @return the SOCKS version if present, null otherwise
307
+ */
308
+ public String getSocksVersion () {
309
+ return socksVersion ;
310
+ }
311
+
312
+ /**
313
+ * Specifies which version of SOCKS to use (4 or 5).
314
+ *
315
+ * @param socksVersion SOCKS version, 4 or 5
316
+ * @return reference to self
317
+ */
318
+ public Proxy setSocksVersion (String socksVersion ) {
319
+ verifyProxyTypeCompatibility (ProxyType .MANUAL );
320
+ this .proxyType = ProxyType .MANUAL ;
321
+ this .socksVersion = socksVersion ;
322
+ return this ;
323
+ }
324
+
296
325
/**
297
326
* Gets the SOCKS proxy's username. Supported by SOCKS v5 and above.
298
327
*
0 commit comments