Fix 'unsupported address type error' in UDP tests / Fix checkstyle

This commit is contained in:
Trustin Lee 2013-04-24 17:43:24 +09:00
parent cee0dc6f81
commit 8a4e708847
2 changed files with 3 additions and 2 deletions

View File

@ -123,7 +123,8 @@ public final class NetUtil {
// Create IPv6 loopback address. // Create IPv6 loopback address.
Inet6Address localhost6 = null; Inet6Address localhost6 = null;
try { try {
localhost6 = (Inet6Address) InetAddress.getByAddress(new byte[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1}); localhost6 = (Inet6Address) InetAddress.getByAddress(
new byte[]{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1});
} catch (Exception e) { } catch (Exception e) {
// We should not get here as long as the length of the address is correct. // We should not get here as long as the length of the address is correct.
PlatformDependent.throwException(e); PlatformDependent.throwException(e);

View File

@ -49,7 +49,7 @@ public abstract class AbstractDatagramTest {
sb = e.getKey().newInstance(); sb = e.getKey().newInstance();
cb = e.getValue().newInstance(); cb = e.getValue().newInstance();
addr = new InetSocketAddress( addr = new InetSocketAddress(
NetUtil.LOCALHOST, TestUtils.getFreePort()); NetUtil.LOCALHOST4, TestUtils.getFreePort());
sb.localAddress(addr); sb.localAddress(addr);
cb.localAddress(0).remoteAddress(addr); cb.localAddress(0).remoteAddress(addr);