Loading tests/integration/src/android/net/ip/IpClientIntegrationTest.java +10 −6 Original line number Diff line number Diff line Loading @@ -1240,12 +1240,16 @@ public class IpClientIntegrationTest { == (byte) ICMPV6_ROUTER_SOLICITATION; } private void waitForRouterSolicitation() throws ParseException { byte[] packet; while ((packet = mPacketReader.popPacket(PACKET_TIMEOUT_MS)) != null) { if (isRouterSolicitation(packet)) return; } fail("No router solicitation received on interface within timeout"); /** * Wait for any router solicitation to have arrived since the packet reader was received. * * This method does not affect packets obtained via mPacketReader.popPacket. After any router * solicitation has been received, calls to this method will just return immediately. */ private void waitForRouterSolicitation() { assertNotNull("No router solicitation received on interface within timeout", mPacketReader.getReceivedPackets().poll( PACKET_TIMEOUT_MS, 0 /* pos */, this::isRouterSolicitation)); } private void sendRouterAdvertisement(boolean waitForRs, short lifetime) throws Exception { Loading tests/lib/src/com/android/testutils/TapPacketReader.java +8 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,14 @@ public class TapPacketReader extends PacketReader { return mReadHead.getValue().poll(timeoutMs, filter::test); } /** * Get the {@link ArrayTrackRecord} that records all packets received by the reader since its * creation. */ public ArrayTrackRecord<byte[]> getReceivedPackets() { return mReceivedPackets; } public void sendResponse(final ByteBuffer packet) throws IOException { try (FileOutputStream out = new FileOutputStream(mTapFd)) { byte[] packetBytes = new byte[packet.limit()]; Loading Loading
tests/integration/src/android/net/ip/IpClientIntegrationTest.java +10 −6 Original line number Diff line number Diff line Loading @@ -1240,12 +1240,16 @@ public class IpClientIntegrationTest { == (byte) ICMPV6_ROUTER_SOLICITATION; } private void waitForRouterSolicitation() throws ParseException { byte[] packet; while ((packet = mPacketReader.popPacket(PACKET_TIMEOUT_MS)) != null) { if (isRouterSolicitation(packet)) return; } fail("No router solicitation received on interface within timeout"); /** * Wait for any router solicitation to have arrived since the packet reader was received. * * This method does not affect packets obtained via mPacketReader.popPacket. After any router * solicitation has been received, calls to this method will just return immediately. */ private void waitForRouterSolicitation() { assertNotNull("No router solicitation received on interface within timeout", mPacketReader.getReceivedPackets().poll( PACKET_TIMEOUT_MS, 0 /* pos */, this::isRouterSolicitation)); } private void sendRouterAdvertisement(boolean waitForRs, short lifetime) throws Exception { Loading
tests/lib/src/com/android/testutils/TapPacketReader.java +8 −0 Original line number Diff line number Diff line Loading @@ -72,6 +72,14 @@ public class TapPacketReader extends PacketReader { return mReadHead.getValue().poll(timeoutMs, filter::test); } /** * Get the {@link ArrayTrackRecord} that records all packets received by the reader since its * creation. */ public ArrayTrackRecord<byte[]> getReceivedPackets() { return mReceivedPackets; } public void sendResponse(final ByteBuffer packet) throws IOException { try (FileOutputStream out = new FileOutputStream(mTapFd)) { byte[] packetBytes = new byte[packet.limit()]; Loading