Adding socksVersion property to conform to W3C
private String noProxy;
private String sslProxy;
private String socksProxy;
+ private String socksVersion;
private String socksUsername;
private String socksPassword;
private String proxyAutoconfigUrl;
@@ -80,6 +81,9 @@ public Proxy(Map<String, ?> raw) {
if (raw.containsKey("socksProxy") && raw.get("socksProxy") != null) {
setSocksProxy((String) raw.get("socksProxy"));
}
+ if (raw.containsKey("socksVersion") && raw.get("socksVersion") != null) {
+ setSocksProxy((String) raw.get("socksVersion"));
+ }
if (raw.containsKey("socksUsername") && raw.get("socksUsername") != null) {
setSocksUsername((String) raw.get("socksUsername"));
}
@@ -115,6 +119,9 @@ public Proxy(Map<String, ?> raw) {
if (socksProxy != null) {
m.put("socksProxy", socksProxy);
}
+ if (socksVersion != null) {
+ m.put("socksProxyVersion", socksVersion);
+ }
if (socksUsername != null) {
m.put("socksUsername", socksUsername);
}
@@ -293,6 +300,28 @@ public Proxy setSocksProxy(String socksProxy) {
return this;
}
+ /**
+ * Gets the SOCKS version (4 or 5).
+ *
+ * @return the SOCKS version if present, null otherwise
+ */
+ public String getSocksVersion() {
+ return socksVersion;
+ }
+
+ /**
+ * Specifies which version of SOCKS to use (4 or 5).
+ *
+ * @param socksVersion SOCKS version, 4 or 5
+ * @return reference to self
+ */
+ public Proxy setSocksVersion(String socksVersion) {
+ verifyProxyTypeCompatibility(ProxyType.MANUAL);
+ this.proxyType = ProxyType.MANUAL;
+ this.socksVersion = socksVersion;
+ return this;
+ }
+
/**
* Gets the SOCKS proxy's username. Supported by SOCKS v5 and above.
*
