Fix missing socket closure in LocalSocketTest
Noticed as a result of 8fbc09bde8.
One of the AF_UNIX sockets being created in three tests was not
being closed (until GC/finalization). Because the name is now
used in multiple tests some of the tests would fail in the CTS
test runner ("Address already in use") if no GC had occurred.
Bug: 3106438
Change-Id: I7debe5ed26d9d09e71a3d8a1b5b7d85b13e6e069
This commit is contained in:
@@ -116,7 +116,7 @@ public class LocalSocketTest extends AndroidTestCase{
|
||||
|
||||
public void testAccessors() throws IOException{
|
||||
LocalSocket socket = new LocalSocket();
|
||||
LocalSocketAddress addr = new LocalSocketAddress("secondary");
|
||||
LocalSocketAddress addr = new LocalSocketAddress(mSockAddr);
|
||||
|
||||
assertFalse(socket.isBound());
|
||||
socket.bind(addr);
|
||||
@@ -170,6 +170,8 @@ public class LocalSocketTest extends AndroidTestCase{
|
||||
} catch (UnsupportedOperationException e) {
|
||||
// expected
|
||||
}
|
||||
|
||||
socket.close();
|
||||
}
|
||||
|
||||
public void testAvailable() throws Exception {
|
||||
@@ -198,6 +200,7 @@ public class LocalSocketTest extends AndroidTestCase{
|
||||
|
||||
clientSocket.close();
|
||||
serverSocket.close();
|
||||
localServerSocket.close();
|
||||
}
|
||||
|
||||
public void testFlush() throws Exception {
|
||||
@@ -220,6 +223,7 @@ public class LocalSocketTest extends AndroidTestCase{
|
||||
|
||||
clientSocket.close();
|
||||
serverSocket.close();
|
||||
localServerSocket.close();
|
||||
}
|
||||
|
||||
private void testFlushWorks(OutputStream outputStream, InputStream inputStream)
|
||||
|
||||
Reference in New Issue
Block a user