test stuff
This commit is contained in:
parent
4a9e360914
commit
84f5dd1ca5
|
@ -18,7 +18,10 @@
|
|||
|
||||
package org.hyperic.sigar.test;
|
||||
|
||||
import org.hyperic.sigar.NetConnection;
|
||||
import org.hyperic.sigar.NetFlags;
|
||||
import org.hyperic.sigar.NetInfo;
|
||||
import org.hyperic.sigar.NetInterfaceConfig;
|
||||
import org.hyperic.sigar.SigarException;
|
||||
|
||||
public class TestNetInfo extends SigarTestCase {
|
||||
|
@ -29,5 +32,20 @@ public class TestNetInfo extends SigarTestCase {
|
|||
|
||||
public void testNetInfo() throws SigarException {
|
||||
NetInfo info = getSigar().getNetInfo();
|
||||
NetInterfaceConfig config = getSigar().getNetInterfaceConfig(null);
|
||||
traceln("");
|
||||
traceln(info.toString());
|
||||
traceln(config.toString());
|
||||
|
||||
int flags = NetFlags.CONN_SERVER | NetFlags.CONN_TCP;
|
||||
|
||||
NetConnection[] connections =
|
||||
getSigar().getNetConnectionList(flags);
|
||||
|
||||
for (int i=0; i<connections.length; i++) {
|
||||
long port = connections[i].getLocalPort();
|
||||
traceln("Listen " +
|
||||
getSigar().getNetListenAddress(port) + ":" + port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -25,8 +25,6 @@ import org.hyperic.sigar.Sigar;
|
|||
import org.hyperic.sigar.SigarNotImplementedException;
|
||||
|
||||
public class TestNetStat extends SigarTestCase {
|
||||
private static boolean printListeners =
|
||||
"true".equals(System.getProperty("sigar.netstat.listeners"));
|
||||
|
||||
public TestNetStat(String name) {
|
||||
super(name);
|
||||
|
@ -49,20 +47,5 @@ public class TestNetStat extends SigarTestCase {
|
|||
for (int i=0; i<NetFlags.TCP_UNKNOWN; i++) {
|
||||
assertGtEqZeroTrace(NetConnection.getStateString(i), states[i]);
|
||||
}
|
||||
|
||||
if (!printListeners) {
|
||||
return;
|
||||
}
|
||||
|
||||
int flags = NetFlags.CONN_SERVER | NetFlags.CONN_TCP;
|
||||
|
||||
NetConnection[] connections =
|
||||
sigar.getNetConnectionList(flags);
|
||||
|
||||
for (int i=0; i<connections.length; i++) {
|
||||
long port = connections[i].getLocalPort();
|
||||
traceln("Listen " +
|
||||
sigar.getNetListenAddress(port) + ":" + port);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue