diff options
Diffstat (limited to 'harmony-tests/src/test')
-rw-r--r-- | harmony-tests/src/test/java/org/apache/harmony/tests/java/net/DatagramSocketTest.java | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/DatagramSocketTest.java b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/DatagramSocketTest.java index e585b14..d9f3d91 100644 --- a/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/DatagramSocketTest.java +++ b/harmony-tests/src/test/java/org/apache/harmony/tests/java/net/DatagramSocketTest.java @@ -745,12 +745,13 @@ public class DatagramSocketTest extends junit.framework.TestCase { public void test_getLocalSocketAddress_ANY() throws Exception { DatagramSocket s = new DatagramSocket(0); - try { - assertTrue("ANY address not IPv6: " + s.getLocalSocketAddress(), - ((InetSocketAddress) s.getLocalSocketAddress()).getAddress() instanceof Inet6Address); - } finally { - s.close(); - } + assertEquals("ANY address not IPv6: " + s.getLocalSocketAddress(), + Inet6Address.ANY, s.getLocalAddress()); + s.close(); + s = new DatagramSocket(0, null); + assertEquals(Inet6Address.ANY, s.getLocalAddress()); + assertFalse(0 == s.getLocalPort()); + s.close(); } public void test_setReuseAddressZ() throws Exception { |