2012-07-06 101 views
0

当我运行CTS情况:android.net.cts.ListeningPortsTest:: testNoListeningUdp6Ports,它失败了,痕迹如下:为什么断言:android.net.cts.ListeningPortsTest :: testNoListeningUdp6Ports

android.net.cts.ListeningPortsTest$ListeningPortsAssertionError: Found port listening on addr=00000000000000000000000000000000, port=43012, UID=1000 in /proc/net/udp6 at android.net.cts.ListeningPortsTest.assertNoListeningPorts(ListeningPortsTest.java:130)

这种情况从文件/ proc/net/udp6获得udp6端口信息,但是如果udp6端口的状态为“07”,表示CLOSED(如include/net/tcp_states.h已定义),为什么isPortListening()返回“真实“都是一样的。然后,案件认为udp6端口正在侦听,并抛出异常。

所以,我觉得在这种情况下可能有什么问题,有人可以解释吗?谢谢。

附录:

private static boolean isPortListening(String state, boolean isTcp) { 
    // 0A = TCP_LISTEN from include/net/tcp_states.h 
    String listeningState = isTcp ? "0A" : "07"; 
    return listeningState.equals(state); 
} 

回答

1

isTcp参数设定为false在该方法中testNoListeningUdp6Ports,但在testNoListeningTcp6Ports它是true

相关问题