Skip to content
Snippets Groups Projects
Commit 24563fa5 authored by Yang Sun's avatar Yang Sun Committed by Gerrit Code Review
Browse files

Merge "NetworkUtilsTest.testSetSockOptBytes" into main

parents e2021fde 0cd8f7f4
No related branches found
No related tags found
No related merge requests found
......@@ -159,10 +159,9 @@ public class NetworkUtilsTest {
return timeval;
}
@Test
public void testSetSockOptBytes() throws ErrnoException {
final FileDescriptor sock = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
final StructTimeval writeTimeval = StructTimeval.fromMillis(1200);
private void testSetSockOptBytes(FileDescriptor sock, long timeValMillis)
throws ErrnoException {
final StructTimeval writeTimeval = StructTimeval.fromMillis(timeValMillis);
byte[] timeval = getTimevalBytes(writeTimeval);
final StructTimeval readTimeval;
......@@ -170,6 +169,16 @@ public class NetworkUtilsTest {
readTimeval = Os.getsockoptTimeval(sock, SOL_SOCKET, SO_RCVTIMEO);
assertEquals(writeTimeval, readTimeval);
}
@Test
public void testSetSockOptBytes() throws ErrnoException {
final FileDescriptor sock = Os.socket(AF_INET6, SOCK_DGRAM, IPPROTO_ICMPV6);
testSetSockOptBytes(sock, 3000);
testSetSockOptBytes(sock, 5000);
SocketUtils.closeSocketQuietly(sock);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment