diff options
author | Neil Fuller <nfuller@google.com> | 2016-09-19 14:49:39 +0100 |
---|---|---|
committer | Neil Fuller <nfuller@google.com> | 2016-09-19 16:19:23 +0100 |
commit | 0485c8f6c41eae7fed190d56cd542d659b601f54 (patch) | |
tree | cba6252315fb1c959f7b6b0977a230f84b595db5 /annotations/generate_annotated_java_files.py | |
parent | 979fbd7f58c33df7534cbc10a31cfc6aea85aac2 (diff) |
Improve testing around pending connect() exceptions
disconnect() started failing in tests after
commit 6764aa32a4b66a3c589f4a00615a1e36d87f308f and it was
only caught by accident by other tests that happen to use
unreachable IPv6 addresses with bad network interfaces,
though this does not appear to be their main purpose.
This commit modifies test_b31218085 to confirm disconnect()
works when there are internal SocketExceptions thrown during
connect(), e.g. because of unreachable network addresses that
the host can detect.
It also changes testPendingException() to use the same
"connect() spoiler" mechanism / call disconnect().
An explicit test has been added to confirm the
"connect() spoiler" mechanism works as expected by testing
it with a version of the connect() method that is able to
throw a SocketException immediately.
Another test has been changed to use try-with-resources to
clean up.
Note: The close(), called by the try-with-resources is not the
same as calling disconnect().
Bug: 31218085
Test: libcore.java.net.DatagramSocketTest
Change-Id: If74426ae9eb6b5a8cbfec008186faa2f9798d0b7
Diffstat (limited to 'annotations/generate_annotated_java_files.py')
0 files changed, 0 insertions, 0 deletions