blob: 241d61fa561bfed0b0f2cd98cb2dba2d162776db [file] [log] [blame]
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +09001/*
2 * Copyright (C) 2014 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17package android.net;
18
Chalard Jeane47850d2020-06-26 00:41:26 +090019import static com.android.testutils.MiscAsserts.assertEqualBothWays;
Chalard Jeane47850d2020-06-26 00:41:26 +090020import static com.android.testutils.MiscAsserts.assertNotEqualEitherWay;
21import static com.android.testutils.ParcelUtils.assertParcelingIsLossless;
Chalard Jean64802872019-05-30 17:11:14 +090022
Hugo Benichi207b7572016-11-10 22:45:56 +090023import static org.junit.Assert.assertArrayEquals;
24import static org.junit.Assert.assertEquals;
Hugo Benichi3054e102017-08-08 13:06:04 +090025import static org.junit.Assert.assertFalse;
26import static org.junit.Assert.assertNotEquals;
Hugo Benichi3054e102017-08-08 13:06:04 +090027import static org.junit.Assert.assertTrue;
28import static org.junit.Assert.fail;
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090029
Brett Chabotab11bf12019-03-04 14:14:56 -080030import androidx.test.filters.SmallTest;
31import androidx.test.runner.AndroidJUnit4;
32
33import org.junit.Test;
34import org.junit.runner.RunWith;
Hugo Benichi3054e102017-08-08 13:06:04 +090035
36import java.net.InetAddress;
37import java.util.Random;
38
Hugo Benichi3054e102017-08-08 13:06:04 +090039@RunWith(AndroidJUnit4.class)
40@SmallTest
41public class IpPrefixTest {
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090042
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090043 private static InetAddress address(String addr) {
Erik Kline8a100e32015-04-13 15:33:34 +090044 return InetAddress.parseNumericAddress(addr);
45 }
46
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090047 // Explicitly cast everything to byte because "error: possible loss of precision".
48 private static final byte[] IPV4_BYTES = { (byte) 192, (byte) 0, (byte) 2, (byte) 4};
49 private static final byte[] IPV6_BYTES = {
50 (byte) 0x20, (byte) 0x01, (byte) 0x0d, (byte) 0xb8,
51 (byte) 0xde, (byte) 0xad, (byte) 0xbe, (byte) 0xef,
52 (byte) 0x0f, (byte) 0x00, (byte) 0x00, (byte) 0x00,
53 (byte) 0x00, (byte) 0x00, (byte) 0x00, (byte) 0xa0
54 };
55
Hugo Benichi3054e102017-08-08 13:06:04 +090056 @Test
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090057 public void testConstructor() {
58 IpPrefix p;
59 try {
60 p = new IpPrefix((byte[]) null, 9);
61 fail("Expected NullPointerException: null byte array");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090062 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090063
64 try {
65 p = new IpPrefix((InetAddress) null, 10);
66 fail("Expected NullPointerException: null InetAddress");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090067 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090068
69 try {
70 p = new IpPrefix((String) null);
71 fail("Expected NullPointerException: null String");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090072 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090073
74
75 try {
76 byte[] b2 = {1, 2, 3, 4, 5};
77 p = new IpPrefix(b2, 29);
78 fail("Expected IllegalArgumentException: invalid array length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090079 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090080
81 try {
82 p = new IpPrefix("1.2.3.4");
83 fail("Expected IllegalArgumentException: no prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090084 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090085
86 try {
87 p = new IpPrefix("1.2.3.4/");
88 fail("Expected IllegalArgumentException: empty prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090089 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090090
91 try {
92 p = new IpPrefix("foo/32");
93 fail("Expected IllegalArgumentException: invalid address");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090094 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +090095
96 try {
97 p = new IpPrefix("1/32");
98 fail("Expected IllegalArgumentException: deprecated IPv4 format");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +090099 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900100
101 try {
102 p = new IpPrefix("1.2.3.256/32");
103 fail("Expected IllegalArgumentException: invalid IPv4 address");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900104 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900105
106 try {
107 p = new IpPrefix("foo/32");
108 fail("Expected IllegalArgumentException: non-address");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900109 } catch (IllegalArgumentException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900110
111 try {
112 p = new IpPrefix("f00:::/32");
113 fail("Expected IllegalArgumentException: invalid IPv6 address");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900114 } catch (IllegalArgumentException expected) { }
paulhucbe73812021-03-03 22:15:11 +0800115
116 p = new IpPrefix("/64");
117 assertEquals("::/64", p.toString());
118
119 p = new IpPrefix("/128");
120 assertEquals("::1/128", p.toString());
121
122 p = new IpPrefix("[2001:db8::123]/64");
123 assertEquals("2001:db8::/64", p.toString());
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900124 }
125
Hugo Benichi3054e102017-08-08 13:06:04 +0900126 @Test
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900127 public void testTruncation() {
128 IpPrefix p;
129
130 p = new IpPrefix(IPV4_BYTES, 32);
131 assertEquals("192.0.2.4/32", p.toString());
132
133 p = new IpPrefix(IPV4_BYTES, 29);
134 assertEquals("192.0.2.0/29", p.toString());
135
136 p = new IpPrefix(IPV4_BYTES, 8);
137 assertEquals("192.0.0.0/8", p.toString());
138
139 p = new IpPrefix(IPV4_BYTES, 0);
140 assertEquals("0.0.0.0/0", p.toString());
141
142 try {
143 p = new IpPrefix(IPV4_BYTES, 33);
144 fail("Expected IllegalArgumentException: invalid prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900145 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900146
147 try {
148 p = new IpPrefix(IPV4_BYTES, 128);
149 fail("Expected IllegalArgumentException: invalid prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900150 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900151
152 try {
153 p = new IpPrefix(IPV4_BYTES, -1);
154 fail("Expected IllegalArgumentException: negative prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900155 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900156
157 p = new IpPrefix(IPV6_BYTES, 128);
158 assertEquals("2001:db8:dead:beef:f00::a0/128", p.toString());
159
160 p = new IpPrefix(IPV6_BYTES, 122);
161 assertEquals("2001:db8:dead:beef:f00::80/122", p.toString());
162
163 p = new IpPrefix(IPV6_BYTES, 64);
164 assertEquals("2001:db8:dead:beef::/64", p.toString());
165
166 p = new IpPrefix(IPV6_BYTES, 3);
167 assertEquals("2000::/3", p.toString());
168
169 p = new IpPrefix(IPV6_BYTES, 0);
170 assertEquals("::/0", p.toString());
171
172 try {
173 p = new IpPrefix(IPV6_BYTES, -1);
174 fail("Expected IllegalArgumentException: negative prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900175 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900176
177 try {
178 p = new IpPrefix(IPV6_BYTES, 129);
179 fail("Expected IllegalArgumentException: negative prefix length");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900180 } catch (RuntimeException expected) { }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900181
182 }
183
Hugo Benichi3054e102017-08-08 13:06:04 +0900184 @Test
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900185 public void testEquals() {
186 IpPrefix p1, p2;
187
188 p1 = new IpPrefix("192.0.2.251/23");
189 p2 = new IpPrefix(new byte[]{(byte) 192, (byte) 0, (byte) 2, (byte) 251}, 23);
Chalard Jean64802872019-05-30 17:11:14 +0900190 assertEqualBothWays(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900191
192 p1 = new IpPrefix("192.0.2.5/23");
Chalard Jean64802872019-05-30 17:11:14 +0900193 assertEqualBothWays(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900194
195 p1 = new IpPrefix("192.0.2.5/24");
Chalard Jean64802872019-05-30 17:11:14 +0900196 assertNotEqualEitherWay(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900197
198 p1 = new IpPrefix("192.0.4.5/23");
Chalard Jean64802872019-05-30 17:11:14 +0900199 assertNotEqualEitherWay(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900200
201
202 p1 = new IpPrefix("2001:db8:dead:beef:f00::80/122");
203 p2 = new IpPrefix(IPV6_BYTES, 122);
204 assertEquals("2001:db8:dead:beef:f00::80/122", p2.toString());
Chalard Jean64802872019-05-30 17:11:14 +0900205 assertEqualBothWays(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900206
207 p1 = new IpPrefix("2001:db8:dead:beef:f00::bf/122");
Chalard Jean64802872019-05-30 17:11:14 +0900208 assertEqualBothWays(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900209
210 p1 = new IpPrefix("2001:db8:dead:beef:f00::8:0/123");
Chalard Jean64802872019-05-30 17:11:14 +0900211 assertNotEqualEitherWay(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900212
213 p1 = new IpPrefix("2001:db8:dead:beef::/122");
Chalard Jean64802872019-05-30 17:11:14 +0900214 assertNotEqualEitherWay(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900215
216 // 192.0.2.4/32 != c000:0204::/32.
217 byte[] ipv6bytes = new byte[16];
218 System.arraycopy(IPV4_BYTES, 0, ipv6bytes, 0, IPV4_BYTES.length);
219 p1 = new IpPrefix(ipv6bytes, 32);
Chalard Jean64802872019-05-30 17:11:14 +0900220 assertEqualBothWays(p1, new IpPrefix("c000:0204::/32"));
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900221
222 p2 = new IpPrefix(IPV4_BYTES, 32);
Chalard Jean64802872019-05-30 17:11:14 +0900223 assertNotEqualEitherWay(p1, p2);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900224 }
225
Hugo Benichi3054e102017-08-08 13:06:04 +0900226 @Test
Chalard Jean687546e2018-02-26 11:52:46 +0900227 public void testContainsInetAddress() {
Erik Kline8a100e32015-04-13 15:33:34 +0900228 IpPrefix p = new IpPrefix("2001:db8:f00::ace:d00d/127");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900229 assertTrue(p.contains(address("2001:db8:f00::ace:d00c")));
230 assertTrue(p.contains(address("2001:db8:f00::ace:d00d")));
231 assertFalse(p.contains(address("2001:db8:f00::ace:d00e")));
232 assertFalse(p.contains(address("2001:db8:f00::bad:d00d")));
233 assertFalse(p.contains(address("2001:4868:4860::8888")));
234 assertFalse(p.contains(address("8.8.8.8")));
Erik Kline8a100e32015-04-13 15:33:34 +0900235
236 p = new IpPrefix("192.0.2.0/23");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900237 assertTrue(p.contains(address("192.0.2.43")));
238 assertTrue(p.contains(address("192.0.3.21")));
239 assertFalse(p.contains(address("192.0.0.21")));
240 assertFalse(p.contains(address("8.8.8.8")));
241 assertFalse(p.contains(address("2001:4868:4860::8888")));
Erik Kline8a100e32015-04-13 15:33:34 +0900242
243 IpPrefix ipv6Default = new IpPrefix("::/0");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900244 assertTrue(ipv6Default.contains(address("2001:db8::f00")));
245 assertFalse(ipv6Default.contains(address("192.0.2.1")));
Erik Kline8a100e32015-04-13 15:33:34 +0900246
247 IpPrefix ipv4Default = new IpPrefix("0.0.0.0/0");
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900248 assertTrue(ipv4Default.contains(address("255.255.255.255")));
249 assertTrue(ipv4Default.contains(address("192.0.2.1")));
250 assertFalse(ipv4Default.contains(address("2001:db8::f00")));
Erik Kline8a100e32015-04-13 15:33:34 +0900251 }
252
Hugo Benichi3054e102017-08-08 13:06:04 +0900253 @Test
Chalard Jean687546e2018-02-26 11:52:46 +0900254 public void testContainsIpPrefix() {
255 assertTrue(new IpPrefix("0.0.0.0/0").containsPrefix(new IpPrefix("0.0.0.0/0")));
256 assertTrue(new IpPrefix("0.0.0.0/0").containsPrefix(new IpPrefix("1.2.3.4/0")));
257 assertTrue(new IpPrefix("0.0.0.0/0").containsPrefix(new IpPrefix("1.2.3.4/8")));
258 assertTrue(new IpPrefix("0.0.0.0/0").containsPrefix(new IpPrefix("1.2.3.4/24")));
259 assertTrue(new IpPrefix("0.0.0.0/0").containsPrefix(new IpPrefix("1.2.3.4/23")));
260
261 assertTrue(new IpPrefix("1.2.3.4/8").containsPrefix(new IpPrefix("1.2.3.4/8")));
262 assertTrue(new IpPrefix("1.2.3.4/8").containsPrefix(new IpPrefix("1.254.12.9/8")));
263 assertTrue(new IpPrefix("1.2.3.4/21").containsPrefix(new IpPrefix("1.2.3.4/21")));
264 assertTrue(new IpPrefix("1.2.3.4/32").containsPrefix(new IpPrefix("1.2.3.4/32")));
265
266 assertTrue(new IpPrefix("1.2.3.4/20").containsPrefix(new IpPrefix("1.2.3.0/24")));
267
268 assertFalse(new IpPrefix("1.2.3.4/32").containsPrefix(new IpPrefix("1.2.3.5/32")));
269 assertFalse(new IpPrefix("1.2.3.4/8").containsPrefix(new IpPrefix("2.2.3.4/8")));
270 assertFalse(new IpPrefix("0.0.0.0/16").containsPrefix(new IpPrefix("0.0.0.0/15")));
271 assertFalse(new IpPrefix("100.0.0.0/8").containsPrefix(new IpPrefix("99.0.0.0/8")));
272
273 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("::/0")));
274 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("2001:db8::f00/1")));
275 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("3d8a:661:a0::770/8")));
276 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("2001:db8::f00/8")));
277 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("2001:db8::f00/64")));
278 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("2001:db8::f00/113")));
279 assertTrue(new IpPrefix("::/0").containsPrefix(new IpPrefix("2001:db8::f00/128")));
280
281 assertTrue(new IpPrefix("2001:db8:f00::ace:d00d/64").containsPrefix(
282 new IpPrefix("2001:db8:f00::ace:d00d/64")));
283 assertTrue(new IpPrefix("2001:db8:f00::ace:d00d/64").containsPrefix(
284 new IpPrefix("2001:db8:f00::ace:d00d/120")));
285 assertFalse(new IpPrefix("2001:db8:f00::ace:d00d/64").containsPrefix(
286 new IpPrefix("2001:db8:f00::ace:d00d/32")));
287 assertFalse(new IpPrefix("2001:db8:f00::ace:d00d/64").containsPrefix(
288 new IpPrefix("2006:db8:f00::ace:d00d/96")));
289
290 assertTrue(new IpPrefix("2001:db8:f00::ace:d00d/128").containsPrefix(
291 new IpPrefix("2001:db8:f00::ace:d00d/128")));
292 assertTrue(new IpPrefix("2001:db8:f00::ace:d00d/100").containsPrefix(
293 new IpPrefix("2001:db8:f00::ace:ccaf/110")));
294
295 assertFalse(new IpPrefix("2001:db8:f00::ace:d00d/128").containsPrefix(
296 new IpPrefix("2001:db8:f00::ace:d00e/128")));
297 assertFalse(new IpPrefix("::/30").containsPrefix(new IpPrefix("::/29")));
298 }
299
300 @Test
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900301 public void testHashCode() {
Hugo Benichi207b7572016-11-10 22:45:56 +0900302 IpPrefix p = new IpPrefix(new byte[4], 0);
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900303 Random random = new Random();
304 for (int i = 0; i < 100; i++) {
Hugo Benichi207b7572016-11-10 22:45:56 +0900305 final IpPrefix oldP = p;
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900306 if (random.nextBoolean()) {
307 // IPv4.
308 byte[] b = new byte[4];
309 random.nextBytes(b);
310 p = new IpPrefix(b, random.nextInt(33));
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900311 } else {
312 // IPv6.
313 byte[] b = new byte[16];
314 random.nextBytes(b);
315 p = new IpPrefix(b, random.nextInt(129));
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900316 }
Hugo Benichi207b7572016-11-10 22:45:56 +0900317 if (p.equals(oldP)) {
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900318 assertEquals(p.hashCode(), oldP.hashCode());
Hugo Benichi207b7572016-11-10 22:45:56 +0900319 }
320 if (p.hashCode() != oldP.hashCode()) {
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900321 assertNotEquals(p, oldP);
Hugo Benichi207b7572016-11-10 22:45:56 +0900322 }
323 }
324 }
325
Hugo Benichi3054e102017-08-08 13:06:04 +0900326 @Test
Hugo Benichi207b7572016-11-10 22:45:56 +0900327 public void testHashCodeIsNotConstant() {
328 IpPrefix[] prefixes = {
329 new IpPrefix("2001:db8:f00::ace:d00d/127"),
330 new IpPrefix("192.0.2.0/23"),
331 new IpPrefix("::/0"),
332 new IpPrefix("0.0.0.0/0"),
333 };
334 for (int i = 0; i < prefixes.length; i++) {
Remi NGUYEN VAN4a2659d2019-04-03 17:21:41 +0900335 for (int j = i + 1; j < prefixes.length; j++) {
336 assertNotEquals(prefixes[i].hashCode(), prefixes[j].hashCode());
337 }
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900338 }
339 }
340
Hugo Benichi3054e102017-08-08 13:06:04 +0900341 @Test
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900342 public void testMappedAddressesAreBroken() {
343 // 192.0.2.0/24 != ::ffff:c000:0204/120, but because we use InetAddress,
344 // we are unable to comprehend that.
345 byte[] ipv6bytes = {
346 (byte) 0, (byte) 0, (byte) 0, (byte) 0,
347 (byte) 0, (byte) 0, (byte) 0, (byte) 0,
348 (byte) 0, (byte) 0, (byte) 0xff, (byte) 0xff,
349 (byte) 192, (byte) 0, (byte) 2, (byte) 0};
350 IpPrefix p = new IpPrefix(ipv6bytes, 120);
351 assertEquals(16, p.getRawAddress().length); // Fine.
352 assertArrayEquals(ipv6bytes, p.getRawAddress()); // Fine.
353
354 // Broken.
355 assertEquals("192.0.2.0/120", p.toString());
356 assertEquals(InetAddress.parseNumericAddress("192.0.2.0"), p.getAddress());
357 }
358
Hugo Benichi3054e102017-08-08 13:06:04 +0900359 @Test
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900360 public void testParceling() {
361 IpPrefix p;
362
363 p = new IpPrefix("2001:4860:db8::/64");
364 assertParcelingIsLossless(p);
Hugo Benichi3054e102017-08-08 13:06:04 +0900365 assertTrue(p.isIPv6());
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900366
367 p = new IpPrefix("192.0.2.0/25");
368 assertParcelingIsLossless(p);
Hugo Benichi3054e102017-08-08 13:06:04 +0900369 assertTrue(p.isIPv4());
Lorenzo Colitti2e9b1232014-06-12 13:41:17 +0900370 }
371}