Add additional checks to multicast tests

MulticastSocketTest and DatagramChannelMulticastTest have identical
requirements for picking network interfaces but the logic was
slightly different. This commit brings them into line.

Also, Nougat used to check the IFF_RUNNING flag in
NetworkInterface.isUp() as well as IFF_UP, but this stopped in Oreo.
The IFF_RUNNING flag check is added explicitly in the tests here since
the tests cannot work over an interace that is not "running" either.

See issue 71977275 for the bug that considers altering isUp() behavior.

Bug: 71977275
Bug: 65037707
Test: CTS: run cts -m CtsLibcoreTestCases -t org.apache.harmony.tests.java.net.MulticastSocketTest
Test: CTS: run cts -m CtsLibcoreTestCases -t libcore.java.nio.channels.DatagramChannelMulticastTest
Change-Id: I227a436ff19f2c235d2a3e567fcfc55c909b47fd
2 files changed