Skip to content

Commit ffb1fc1

Browse files
committed
Adding socksVersion property to conform to W3C
1 parent ee7d357 commit ffb1fc1

File tree

1 file changed

+29
-0
lines changed

1 file changed

+29
-0
lines changed

java/client/src/org/openqa/selenium/Proxy.java

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ public enum ProxyType {
5353
private String noProxy;
5454
private String sslProxy;
5555
private String socksProxy;
56+
private String socksVersion;
5657
private String socksUsername;
5758
private String socksPassword;
5859
private String proxyAutoconfigUrl;
@@ -80,6 +81,9 @@ public Proxy(Map<String, ?> raw) {
8081
if (raw.containsKey("socksProxy") && raw.get("socksProxy") != null) {
8182
setSocksProxy((String) raw.get("socksProxy"));
8283
}
84+
if (raw.containsKey("socksVersion") && raw.get("socksVersion") != null) {
85+
setSocksProxy((String) raw.get("socksVersion"));
86+
}
8387
if (raw.containsKey("socksUsername") && raw.get("socksUsername") != null) {
8488
setSocksUsername((String) raw.get("socksUsername"));
8589
}
@@ -115,6 +119,9 @@ public Map<String, Object> toJson() {
115119
if (socksProxy != null) {
116120
m.put("socksProxy", socksProxy);
117121
}
122+
if (socksVersion != null) {
123+
m.put("socksProxyVersion", socksVersion);
124+
}
118125
if (socksUsername != null) {
119126
m.put("socksUsername", socksUsername);
120127
}
@@ -293,6 +300,28 @@ public Proxy setSocksProxy(String socksProxy) {
293300
return this;
294301
}
295302

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+
296325
/**
297326
* Gets the SOCKS proxy's username. Supported by SOCKS v5 and above.
298327
*

0 commit comments

Comments
 (0)