use of org.zaproxy.zap.network.SocksProxy.Version in project zaproxy by zaproxy.
the class SocksProxyUnitTest method shouldGetSocks4From4.
@Test
void shouldGetSocks4From4() {
// Given
String value = "4";
// When
Version version = Version.from(value);
// Then
assertThat(version, is(equalTo(Version.SOCKS4a)));
}
use of org.zaproxy.zap.network.SocksProxy.Version in project zaproxy by zaproxy.
the class SocksProxyUnitTest method shouldGetSocks5From5.
@Test
void shouldGetSocks5From5() {
// Given
String value = "5";
// When
Version version = Version.from(value);
// Then
assertThat(version, is(equalTo(Version.SOCKS5)));
}
use of org.zaproxy.zap.network.SocksProxy.Version in project zaproxy by zaproxy.
the class SocksProxyUnitTest method shouldNotCreateSocksProxyWithNullVersion.
@Test
void shouldNotCreateSocksProxyWithNullVersion() {
// Given
Version version = null;
// When / Then
assertThrows(NullPointerException.class, () -> new SocksProxy(HOST, PORT, version, true));
}
use of org.zaproxy.zap.network.SocksProxy.Version in project zaproxy by zaproxy.
the class SocksProxyUnitTest method shouldGetSocks5FromInvalidValues.
@ParameterizedTest
@NullAndEmptySource
@ValueSource(strings = { "3", "NotAVersion" })
void shouldGetSocks5FromInvalidValues(String value) {
// Given value
// When
Version version = Version.from(value);
// Then
assertThat(version, is(equalTo(Version.SOCKS5)));
}
use of org.zaproxy.zap.network.SocksProxy.Version in project zaproxy by zaproxy.
the class SocksProxyUnitTest method shouldCreateSocksProxy.
@Test
void shouldCreateSocksProxy() {
// Given
String host = "127.0.1.1";
int port = 1234;
// When
SocksProxy socksProxy = new SocksProxy(host, port);
// Then
assertThat(socksProxy.getHost(), is(equalTo(host)));
assertThat(socksProxy.getPort(), is(equalTo(port)));
assertThat(socksProxy.getVersion(), is(equalTo(Version.SOCKS5)));
assertThat(socksProxy.isUseDns(), is(equalTo(true)));
// Given
Version version = Version.SOCKS4a;
boolean useDns = false;
// When
socksProxy = new SocksProxy(host, port, version, useDns);
// Then
assertThat(socksProxy.getHost(), is(equalTo(host)));
assertThat(socksProxy.getPort(), is(equalTo(port)));
assertThat(socksProxy.getVersion(), is(equalTo(version)));
assertThat(socksProxy.isUseDns(), is(equalTo(useDns)));
}
Aggregations