mirror of
https://codeberg.org/Mercury-IM/Smack
synced 2024-11-26 00:02:06 +01:00
Merge pull request #146 from vanitasvitae/fixProxyTest
Fix shouldPreserveAddressOrderOnInsertions test
This commit is contained in:
commit
6775cf862d
1 changed files with 16 additions and 14 deletions
|
@ -30,6 +30,8 @@ import java.net.Socket;
|
|||
import java.net.SocketException;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.jivesoftware.smack.util.StringUtils;
|
||||
|
@ -102,13 +104,11 @@ public class Socks5ProxyTest {
|
|||
@Test
|
||||
public void shouldPreserveAddressOrderOnInsertions() {
|
||||
Socks5Proxy proxy = Socks5Proxy.getSocks5Proxy();
|
||||
List<String> addresses = new ArrayList<>(proxy.getLocalAddresses());
|
||||
|
||||
LinkedHashSet<String> addresses = new LinkedHashSet<>(proxy.getLocalAddresses());
|
||||
|
||||
for (int i = 1 ; i <= 3; i++) {
|
||||
String addr = Integer.toString(i);
|
||||
if (!addresses.contains(addr)) {
|
||||
addresses.add(addr);
|
||||
}
|
||||
addresses.add(Integer.toString(i));
|
||||
}
|
||||
|
||||
for (String address : addresses) {
|
||||
|
@ -116,8 +116,10 @@ public class Socks5ProxyTest {
|
|||
}
|
||||
|
||||
List<String> localAddresses = proxy.getLocalAddresses();
|
||||
|
||||
Iterator<String> iterator = addresses.iterator();
|
||||
for (int i = 0; i < addresses.size(); i++) {
|
||||
assertEquals(addresses.get(i), localAddresses.get(i));
|
||||
assertEquals(iterator.next(), localAddresses.get(i));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue