This is not super useful because it cannot identify different
NetworkCallback objects from each other, but I've found it to be
better than nothing.
Test: manual
Change-Id: Ib402161f361c0f9fb68701bf171cbc99f598dafd
Setting autoStart to false allows tests to manually start the
TapPacketReader rule, either via method call (allowing callers to
specify their own Handler) or an annotation.
Bug: 168868607
Test: atest NetworkStackIntegrationTests using autoStart = false
Change-Id: Ic295d659250795c45181dc3c0ac0aaacba854f0b
This test rule allows tests to easily create a tap interface, a
TapPacketReader on it, and tear them down after the test.
Bug: 168868607
Test: atest NetworkStackIntegrationTests
Change-Id: Ibc167f5c9a8a1b295e8f6c8384a55a1e3410fcdc
Add a startAsyncForTest method to attempt to start the TapPacketReader
on its handler thread. The method will not report failures to start
(especially failures to create the socket), so it is only added in
TapPacketReader for test code, and not FdEventsReader which would be in
production code.
Rename popPacket to poll, keeping the old version as deprecated
for compatibility. "pop" normally refers to removing a packet from the
top of a LIFO stack, so it is not appropriate naming here.
Test: m
Bug: 168868607
Change-Id: I19184aaca018165856d1d5e5d24b976ae75d1664
Add utilities allowing to run lambdas with shell permissions, in kotlin
and java tests.
Bug: 168868607
Test: m
Change-Id: Iaab38d498338b9e95d263789119cd0813983087d
eventuallyExpect is inline function with reified type which
is not accessible from java. Add an open overloaded method to
support the usage.
Bug: 162323152
Test: atest CtsNetTestCasesLatestSdk:ConnectivityManagerTest
Test: atest TestableNetworkCallbackTest
Change-Id: Ifd2256e08d7e5d092d57594350ac8ed1c1727afb
Add an ArpResponder based on a generic PacketResponder class, and a
TestHttpServer based on NanoHttpd.
Test: tests based on these utilities
Bug: 160617623
Bug: 160656765
Change-Id: I50b872a8b23e8df997e8f62f0adc7c0256c4d74d
These files used to be in the network stack directory, but the libs
directory is a much more suitable place for them.
Also fix a typo : ConcurrentIntepreter → ConcurrentInterpreter
Also move {FdEvents,Packet}Reader to internal annotations. That's
what they should have been using in the first place anyway.
Note that this does not fix preupload issues reported by
checkstyle to make review easier. The fixes are in a followup
patch to this one.
Test: checkbuild
Change-Id: I675077fd42cbb092c0e6bd56571f2fc022e582fd