1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-12-23 13:07:59 +01:00

Test Case Added

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7564 b35dd754-fafc-0310-a699-88a17e54d16e
This commit is contained in:
Thiago Camargo 2007-03-15 22:11:15 +00:00 committed by thiago
parent 2324ac06a9
commit 84def0e74a

View file

@ -12,6 +12,9 @@ import org.jivesoftware.smackx.jingle.media.JingleMediaManager;
import org.jivesoftware.smackx.jingle.media.JingleMediaSession; import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
import org.jivesoftware.smackx.jingle.media.PayloadType; import org.jivesoftware.smackx.jingle.media.PayloadType;
import java.net.InetAddress;
import java.net.UnknownHostException;
public class BridgedResolverTest extends SmackTestCase { public class BridgedResolverTest extends SmackTestCase {
private int counter; private int counter;
@ -65,6 +68,46 @@ public class BridgedResolverTest extends SmackTestCase {
assertTrue(valCounter() == 3); assertTrue(valCounter() == 3);
} }
public void testGetPublicIp() {
resetCounter();
String publicIp = RTPBridge.getPublicIP(getConnection(0));
System.out.println(publicIp + " local:" + getConnection(0).getLocalNetworkAddress().getHostAddress());
if (publicIp != null) {
incCounter();
}
try {
InetAddress localaddr = InetAddress.getLocalHost();
System.out.println("main Local IP Address : " + localaddr.getHostAddress());
System.out.println("main Local hostname : " + localaddr.getHostName());
InetAddress[] localaddrs = InetAddress.getAllByName("localhost");
for (int i = 0; i < localaddrs.length; i++) {
if (!localaddrs[i].equals(localaddr)) {
System.out.println("alt Local IP Address : " + localaddrs[i].getHostAddress());
System.out.println("alt Local hostname : " + localaddrs[i].getHostName());
System.out.println();
}
}
}
catch (UnknownHostException e) {
System.err.println("Can't detect localhost : " + e);
}
try {
Thread.sleep(1000);
}
catch (InterruptedException e) {
e.printStackTrace();
}
assertTrue(valCounter() == 1);
}
protected int getMaxConnections() { protected int getMaxConnections() {
return 1; return 1;
} }