Test SOCKS4 client: CONNECTION_REFUSED when connecting

This commit is contained in:
2021-01-22 21:43:22 +01:00
parent d614fa6cbd
commit 6a841fced5

View File

@@ -87,6 +87,22 @@ public class SOCKS4ClientTest {
80);
});
}
/**
* Check that CONNECTION_REFUSED throws exception
*/
@Test
public void connect__responseCONNECTION_REFUSED() {
assertThrows(SOCKSException.class, () -> {
SOCKS4Client.connect(new ByteArrayInputStream(new byte[]{
0, // dummy
SOCKS4Constants.Reply.CONNECTION_REFUSED, // Connection succeeded
}),
new ByteArrayOutputStream(),
"1.1.1.1",
80
);
});
}
/**
* IPv6 is not supported by this SOCKS client so it just throws an exception