@Test
  public void testServerSocket() throws IOException {
    byte[] addr = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 };
    InetAddress inetAddr = InetAddress.getByAddress(addr);

    try {
      bindServerSocket(inetAddr);
      bindNIOServerSocket(inetAddr);
      // if on *nix or windows JDK7, both will pass
    } catch (java.net.SocketException ex) {
      // On Windows JDK6, we will get expected exception:
      // java.net.SocketException: Address family not supported by protocol family
      // or java.net.SocketException: Protocol family not supported
      Assert.assertFalse(ex instanceof BindException);
      Assert.assertTrue(ex.getMessage().toLowerCase(Locale.ROOT).contains("protocol family"));
      LOG.info("Received expected exception:", ex);

      // if this is the case, ensure that we are running on preferIPv4=true
      ensurePreferIPv4();
    }
  }
Checks whether we are effected by the JDK issue on windows, and if so ensures that we are
running with preferIPv4Stack=true.
hbase-server/src/test/java/org/apache/hadoop/hbase/TestIPv6NIOServerSocketChannel.java