diff options
author | Benedict Wong <benedictwong@google.com> | 2017-10-10 20:44:28 -0700 |
---|---|---|
committer | Benedict Wong <benedictwong@google.com> | 2017-10-18 11:43:43 -0700 |
commit | f186d6703ed766f4eca034963536e86c5a75bb7b (patch) | |
tree | b3e06da1639540afa7e8600dd18d81a989765d78 /tests/net/java/com/android/server/IpSecServiceTest.java | |
parent | 3851f132d10db766f1d9a49099ec19a84957afad (diff) |
Return a port from bindToPort() in IpSecService
When binding to a random port, the port number was not being
returned, so the user is incorrectly receiving a port of zero.
Return the port number that was ultimately bound.
Bug: 67662580
Test: Ran CTS test on aosp_angler-eng
Change-Id: I22f4e5cdc83d43dc453788889990feb34e451bd3
Diffstat (limited to 'tests/net/java/com/android/server/IpSecServiceTest.java')
-rw-r--r-- | tests/net/java/com/android/server/IpSecServiceTest.java | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/tests/net/java/com/android/server/IpSecServiceTest.java b/tests/net/java/com/android/server/IpSecServiceTest.java index 83ee361aa2e3..7b0703851441 100644 --- a/tests/net/java/com/android/server/IpSecServiceTest.java +++ b/tests/net/java/com/android/server/IpSecServiceTest.java @@ -21,6 +21,7 @@ import static android.system.OsConstants.EADDRINUSE; import static android.system.OsConstants.IPPROTO_UDP; import static android.system.OsConstants.SOCK_DGRAM; import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotEquals; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.fail; import static org.mockito.Mockito.mock; @@ -174,6 +175,7 @@ public class IpSecServiceTest { mIpSecService.openUdpEncapsulationSocket(0, new Binder()); assertNotNull(udpEncapResp); assertEquals(IpSecManager.Status.OK, udpEncapResp.status); + assertNotEquals(0, udpEncapResp.port); mIpSecService.closeUdpEncapsulationSocket(udpEncapResp.resourceId); udpEncapResp.fileDescriptor.close(); } |