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:
parent
2324ac06a9
commit
84def0e74a
1 changed files with 43 additions and 0 deletions
|
@ -12,6 +12,9 @@ import org.jivesoftware.smackx.jingle.media.JingleMediaManager;
|
|||
import org.jivesoftware.smackx.jingle.media.JingleMediaSession;
|
||||
import org.jivesoftware.smackx.jingle.media.PayloadType;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
public class BridgedResolverTest extends SmackTestCase {
|
||||
|
||||
private int counter;
|
||||
|
@ -65,6 +68,46 @@ public class BridgedResolverTest extends SmackTestCase {
|
|||
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() {
|
||||
return 1;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue