Search in sources :

Example 1 with Version

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)));
}
Also used : Version(org.zaproxy.zap.network.SocksProxy.Version) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 2 with Version

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)));
}
Also used : Version(org.zaproxy.zap.network.SocksProxy.Version) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 3 with Version

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));
}
Also used : Version(org.zaproxy.zap.network.SocksProxy.Version) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 4 with Version

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)));
}
Also used : Version(org.zaproxy.zap.network.SocksProxy.Version) NullAndEmptySource(org.junit.jupiter.params.provider.NullAndEmptySource) ValueSource(org.junit.jupiter.params.provider.ValueSource) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Example 5 with Version

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)));
}
Also used : Version(org.zaproxy.zap.network.SocksProxy.Version) Test(org.junit.jupiter.api.Test) ParameterizedTest(org.junit.jupiter.params.ParameterizedTest)

Aggregations

ParameterizedTest (org.junit.jupiter.params.ParameterizedTest)5 Version (org.zaproxy.zap.network.SocksProxy.Version)5 Test (org.junit.jupiter.api.Test)4 NullAndEmptySource (org.junit.jupiter.params.provider.NullAndEmptySource)1 ValueSource (org.junit.jupiter.params.provider.ValueSource)1