HBASE-19198 TestIPv6NIOServerSocketChannel fails; unable to bind

This commit is contained in:
Michael Stack 2017-11-06 21:19:51 -08:00
parent b6011a16ff
commit d1b6d8c906
1 changed files with 3 additions and 3 deletions

View File

@ -49,7 +49,6 @@ import org.junit.rules.TestRule;
*/ */
@Category({MiscTests.class, SmallTests.class}) @Category({MiscTests.class, SmallTests.class})
public class TestIPv6NIOServerSocketChannel { public class TestIPv6NIOServerSocketChannel {
private static final Log LOG = LogFactory.getLog(TestIPv6NIOServerSocketChannel.class); private static final Log LOG = LogFactory.getLog(TestIPv6NIOServerSocketChannel.class);
@Rule @Rule
@ -69,6 +68,7 @@ public class TestIPv6NIOServerSocketChannel {
break; break;
} catch (BindException ex) { } catch (BindException ex) {
//continue //continue
LOG.info("Failed on " + addr + ", inedAddr=" + inetAddr, ex);
} finally { } finally {
if (serverSocket != null) { if (serverSocket != null) {
serverSocket.close(); serverSocket.close();
@ -151,9 +151,9 @@ public class TestIPv6NIOServerSocketChannel {
*/ */
@Test @Test
public void testServerSocketFromLocalhostResolution() throws IOException { public void testServerSocketFromLocalhostResolution() throws IOException {
InetAddress[] addrs = InetAddress.getAllByName("localhost"); InetAddress[] addrs = {InetAddress.getLocalHost()};
for (InetAddress addr : addrs) { for (InetAddress addr : addrs) {
LOG.info("resolved localhost as:" + addr); LOG.info("Resolved localhost as: " + addr);
bindServerSocket(addr); bindServerSocket(addr);
bindNIOServerSocket(addr); bindNIOServerSocket(addr);
} }