• Home
  • History
  • Annotate
  • only in /libcore/luni/src/test/java/libcore/java/net/
History log of /libcore/luni/src/test/java/libcore/java/net/
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9ad8351d6adce553363c96278c8baadfc2b237eb 05-Nov-2013 Narayan Kamath <narayan@google.com> Merge "Add a test for lower case auth scheme handling." into klp-dev
671a834be6d345a7df01ba19407dd1c96509c785 29-Oct-2013 Narayan Kamath <narayan@google.com> Make getInetAddress generate less garbage.

This function is now on the critical path for URLConnection
since OkHttp calls it to figure out what the MTU for the
NetworkInterface is.

This function performs poorly when there are a large
number of interfaces available.

- Read /proc/net/if_inet6 exactly once, instead of
once per interface.
- List the contents of /sys/class/net exactly once,
and not once per interface.

Also adds a couple of tests for if_inet6 parsing.

TODO: Add a "zero copy" version of UnsafeByteSequence
and then move readIntFile over to that version.

(Cherry picked from ab6d858336e6db8b5117b78837fee2a9f35fdf2c)

Bug: b/11411129

Change-Id: Ieb1d5f0beaf462721f897a5f6376a4587f3aebaf
etworkInterfaceTest.java
ec33de3303760e5ba31bd6d0e6b46d5681c123dc 04-Nov-2013 Narayan Kamath <narayan@google.com> Add a test for lower case auth scheme handling.

bug: 11473660

(Cherry picked from d87ee0f7b587bf19b7bf4c047aa6e5ab0c5045de)

Change-Id: I42fed52e5fdfe0a0ec99dfc8f77330b37a82f772
RLConnectionTest.java
c7de9a3e7f7ea4a7c514df35d3f7838e3da96dcb 21-Aug-2013 Narayan Kamath <narayan@google.com> Merge "Fix tests dealing with retryable bodies." into klp-dev
9f29ddd4fcb1db9c3e0a1b638868e1d82b83f754 21-Aug-2013 Narayan Kamath <narayan@google.com> Merge "Update authentication tests." into klp-dev
47b8f5d55e5184facc5cea4d3e93db86bd96931b 21-Aug-2013 Narayan Kamath <narayan@google.com> Merge "Test that timeouts are respected on recycled connections." into klp-dev
157b95d87eba99a4804aca480ced9c8b99637dc7 21-Aug-2013 Narayan Kamath <narayan@google.com> Update authentication tests.

Test for multiple schemes and multiple auth headers, but
insist that one of schemes is "Basic".

Fixes CTS tests
URLConnectionTest#testAuthenticateWithCommaSeparatedAuthenticationMethods
URLConnectionTest#testAuthenticateWithMultipleAuthenticationHeaders

(cherry picked from d1b438d58c2177c9cebcc3b72df13ac9b7c46e91)

bug: 10211309

Change-Id: Icdc30a5c52cc2c8e3b65abe402732658d4308a88
RLConnectionTest.java
0136437c9973615e02f4a22b622399d6a7063932 21-Aug-2013 Narayan Kamath <narayan@google.com> Test that timeouts are respected on recycled connections.

This is a renamed version of testGetKeepAlive, which wasn't
testing very much in its old form.

(cherry picked from 35e58c073df4a45345e89fe8f4d0f77bf7df878)

bug: 10211309

Change-Id: I08c46f577741817b7de714d362f3426d17984042
RLConnectionTest.java
8a1e42f2cfcb3cab8cfba7a572d68c534598d627 21-Aug-2013 Narayan Kamath <narayan@google.com> Fix tests dealing with retryable bodies.

Test them in a slightly more robust manner.
- Rely on the fallback from Modern TLS for the retry, instead
of a fallback due to a closed socket.
- Use mode DISCONNECT_AFTER_READING_RESPONSE to make sure the
response is consumed before being discarded.

(cherry picked from 2f1d4ee69ef9dc2eb0d9da37ba4ef1c6089d595e)

bug: 10211309

Change-Id: I8227148e1fc04b7557a41ee6485ffe98efb77ace
RLConnectionTest.java
25d659641d20f4ad0b94bb8301cb637edf119129 21-Aug-2013 Narayan Kamath <narayan@google.com> Merge "Update test exercising broken proxy behaviour." into klp-dev
cc440f43ee5cee8b52d6ad86c6926d1189aad37b 20-Aug-2013 Narayan Kamath <narayan@google.com> Track changes to MockWebServer

Track changes in ag/63871 which add bookkeeping requests
to the request queue.

(cherry picked from b27031a36bbb3c64ad0672553122dcebb17c89)

bug: 10211309

Change-Id: I8093bda336950846dafaaba2acaace8ee52713d6
RLConnectionTest.java
3778c428ec5bc08881d8cc8057d79027648b327c 20-Aug-2013 Narayan Kamath <narayan@google.com> Update test exercising broken proxy behaviour.

The test must account for the fact that the connection
will be retried with TLS_MODE_COMPATIBLE if the first
attempt throws an exception.

It's also worth noting that MockWebServer does not
deal with abrupt client disconnections in a particularly
graceful manner (but that does not affect the test,
and I'll address it in a follow up).

(cherry picked from bfdb88fab84756703e01e9b43808a406bdd)

bug: 10211309

Change-Id: I5bf8a8e890df4146ecd0606e50c5a616434fd883
RLConnectionTest.java
3d849f3d37a0b7c4c8b7b0fa5a285289ed99a309 15-Aug-2013 Narayan Kamath <narayan@google.com> Update URLConnection#testLenientUrlToUriNul.

Our earlier behaviour was somewhat broken. We'd accept
hosts with \u0000 in them, and then produce a request with
a bad Host header. We now fail on such requests, so add a
unit test to exercise that new behaviour.

The ideal behaviour might be to be lenient and escape characters
that we don't like. (This would involve using the URI from
URL#toUriLenient to populate the Host header. I attempted that
but it has the side effect of introducing a new set of
incompatibilities).

(cherry picked from aafc934e9e3b5afce7c54162654720fad80)

bug: 10211309

Change-Id: I38a0d39124dc5ca766a6e963e72b0250440e82ee
RLConnectionTest.java
a37fb255a1993e835eea8c934205b1e568a1271c 14-Aug-2013 Narayan Kamath <narayan@google.com> Fix URLConnectionTest#testConnectTimeouts.

Use StuckServer correctly. When StuckServer isn't
in blocking mode, its local socket address isn't 127.0.0.1.

Attempting to connect to localhost will then throw a
SocketException (ECONNREFUSED) instead of a
SocketTimeoutException.

(cherry picked from commit bf1a9e10eefd28bb3a989df20b4a57c745fb3670)

Bug: 10211309
Change-Id: I8aaab598d043b893e73fab9055082fa420cfb9cd
RLConnectionTest.java
8c213bcc2aadb8249d683312505f1068ae74f1a8 12-Jun-2013 Narayan Kamath <narayan@google.com> Fix URLConnectionTest after latest okhttp update.

I've observed 14 failing tests both before and after
the update.

Change-Id: I40dfd9efe35ed03d89b38b030d3c7b6558b247e2
RLConnectionTest.java
d4781a20611fd0424aede028c139bfdbaea5677b 06-May-2013 Brian Carlstrom <bdc@google.com> Make it clearer that a new MockWebServer is created for each test run

Change-Id: Ib3ce11f42d19688fe00b7d057eece25567fccea2
RLConnectionTest.java
255a6f4ab321614ed1ca26849d1df7fa9c0610f5 25-Apr-2013 Elliott Hughes <enh@google.com> Fix getLocalAddress on closed sockets.

Bug: https://code.google.com/p/android/issues/detail?id=54072
Change-Id: Ie32708054f584885ec85dd7847c128d48ff6c7d5
ldAndroidDatagramTest.java
2503556d17b28c7b4e6e514540a77df1627857d0 30-Mar-2013 jwilson <jwilson@squareup.com> Switch to OkHttp as URL's preferred HTTP implementation.

Change-Id: Id724b75dd78b68ed00f5db4989c4070896996ec0
RLConnectionTest.java
2ea0b34ba1e3bf712e052304747a3bc6c78e8208 20-Mar-2013 Kenny Root <kroot@google.com> Mapped IPv4 address test fix

The SubjectAlternativeNameTest was failing on getting a mapped IPv4
address back of the form "::ffff:127.0.0.1" which should be handled
fine.

Added several tests to InetAddressTest to make sure the correct handling
of mapped addresses doesn't regress.

Change-Id: If6e1ca8bda405d4862786404d1ced571743391f2
netAddressTest.java
271e9ada533970e09897bbde8858e991a07ba245 19-Mar-2013 Elliott Hughes <enh@google.com> Fix ConcurrentCloseTest's write test to ensure we're really blocked in write(2).

Bug: 8272932
Change-Id: Id0b9b23176bf179af85bcaf321df5bab05b093be
oncurrentCloseTest.java
d7b0268ad57b3cb494c0d2f6ea3cb004338619c3 18-Oct-2012 Brian Carlstrom <bdc@google.com> am b3503014: Merge "Make sure URL.toURILenient throws the proper exception on trailing garbage escape"

* commit 'b35030149c12026711cca308122544103aec35fe':
Make sure URL.toURILenient throws the proper exception on trailing garbage escape
bb1546d2c87c6f7e996a83b6f0efca17453d53db 18-Oct-2012 Brian Carlstrom <bdc@google.com> Make sure URL.toURILenient throws the proper exception on trailing garbage escape

Previously this would throw IndexOutOfBoundsException instead of the proper checked exception.

Bug: 7369778
Change-Id: I4247240b21a98688bd890c53f654f7a030d72717
RLTest.java
1b18a42ce11e536a12a21166b5e7790a73285af4 17-Oct-2012 Elliott Hughes <enh@google.com> am d2f41fe2: Merge "Fix ConcurrentCloseTest flakiness."

* commit 'd2f41fe210bf0fe958345f84e95e8f037c325005':
Fix ConcurrentCloseTest flakiness.
babccbf9e429c4c78aca24c205825ceaaf7d3f37 13-Oct-2012 Elliott Hughes <enh@google.com> Fix ConcurrentCloseTest flakiness.

We can't rely on consuming all the listen(2) backlog. For the tests we've
seen fail because they sometimes connect rather than time out, switch to
an unroutable address.

Bug: 6971145
Change-Id: I259d31b1a15123bcd78c36849d5ed863d392ac20
oncurrentCloseTest.java
RLConnectionTest.java
2b096f630d94f957b981ef511c70c856893dc47e 16-Oct-2012 Elliott Hughes <enh@google.com> Fix test flakiness.

Support_PortManager is a bad idea, badly implemented. Kill some more of it.
Only OldDatagramSocketTest still uses Support_PortManager, so hopefully we
can kill this completely soon.

Bug: 7347233
Change-Id: I9dec7b23d59edc8c7a5e391dd5ebccd2a92f82b5
ldSocketTest.java
78601286edbfed7ea072814763f661eb80f6e777 10-Oct-2012 Elliott Hughes <enh@google.com> Extra log output for ConcurrentCloseTest flakiness.

No clue what's wrong here, but we're seeing some flakiness in the
"connect" tests. Hopefully there will be a clue in this extra
output next time we see a failure.

(cherry-pick of 735875881f3995ec6a687e65a2e5495304bc48be.)

Bug: 6971145
Change-Id: I8236b2fb368581e2b6965898f109370e7e0af2e5
oncurrentCloseTest.java
735875881f3995ec6a687e65a2e5495304bc48be 10-Oct-2012 Elliott Hughes <enh@google.com> Extra log output for ConcurrentCloseTest flakiness.

No clue what's wrong here, but we're seeing some flakiness in the
"connect" tests. Hopefully there will be a clue in this extra
output next time we see a failure.

Bug: 6971145
Change-Id: Ifed716cba5a17cab84e9535ec054785ee7d09aa7
oncurrentCloseTest.java
b11e44a402eb0f9c5da1f7482fc1eabdd9adff47 20-Sep-2012 Jesse Wilson <jwilson@squareup.com> Fix a bug in tunnel construction and 'Connection: close' headers.

Based on https://github.com/square/okhttp/pull/30
(git fetch git://github.com/square/okhttp.git && git cherry-pick -x b8c51dc5bdc89d5487cbc110d6fe40389de16480)

Bug: http://code.google.com/p/android/issues/detail?id=37221
Bug: 7291446

(cherry picked from commit 4bedacd569fed2db56c518ed239412b3fe32245e)

Change-Id: I68c55e9259db91dbccca30824c00726094570304
RLConnectionTest.java
4bedacd569fed2db56c518ed239412b3fe32245e 20-Sep-2012 Jesse Wilson <jwilson@squareup.com> Fix a bug in tunnel construction and 'Connection: close' headers.

Based on https://github.com/square/okhttp/pull/30
(git fetch git://github.com/square/okhttp.git && git cherry-pick -x b8c51dc5bdc89d5487cbc110d6fe40389de16480)

Bug: http://code.google.com/p/android/issues/detail?id=37221
Change-Id: I5bed33d9ab16002aa38c2f729fa14a2022485469
RLConnectionTest.java
3d43199950729e592ac3e104442b4b350a86aec8 26-Sep-2012 Elliott Hughes <enh@google.com> Fix ConcurrentCloseTest flakiness.

We were running the risk that the server's end of a client socket would get
closed by the finalizer thread, resulting in read(2) returning 0 to the client,
and the test failing like this:

junit.framework.AssertionFailedError: read returned -1
at libcore.java.net.ConcurrentCloseTest.test_read(ConcurrentCloseTest.java:121)
at java.lang.reflect.Method.invokeNative(Native Method)

(cherry-pick of 4bbcd7e5aee1e984a4fcf46385667f9ad03dbc16.)

Bug: 7206024
Change-Id: I0dae214a7ee609655f4f4781abf4457863bcfd5f
oncurrentCloseTest.java
a3045a1b020c91fe803a81353fdcb7ace3e39378 26-Sep-2012 Elliott Hughes <enh@google.com> Merge "Fix ConcurrentCloseTest flakiness."
4bbcd7e5aee1e984a4fcf46385667f9ad03dbc16 26-Sep-2012 Elliott Hughes <enh@google.com> Fix ConcurrentCloseTest flakiness.

We were running the risk that the server's end of a client socket would get
closed by the finalizer thread, resulting in read(2) returning 0 to the client,
and the test failing like this:

junit.framework.AssertionFailedError: read returned -1
at libcore.java.net.ConcurrentCloseTest.test_read(ConcurrentCloseTest.java:121)
at java.lang.reflect.Method.invokeNative(Native Method)

Bug: 7206024
Change-Id: I3f228dc4d3bfb59f6595ebe255de2cf4047d06b8
oncurrentCloseTest.java
6d41a7cc3cb4cc684c8bece69ddc55954812ad6e 24-Sep-2012 Narayan Kamath <narayan@google.com> Strip content length in requests with "transparent" gzip handling.

We need to strip both the Content-Length and the Content-Encoding
for such requests. In such requests, it will be the length of the
compressed response. We hide the fact that compression is taking place
from clients, so we shouldn't give them the content length either.

(cherry picked from commit f9d60aed414ae21811a6488f603333517f257b22)

Change-Id: Ic2776ecf020c34b1c55e2fb7e2f0728e553187a0
RLConnectionTest.java
f9d60aed414ae21811a6488f603333517f257b22 24-Sep-2012 Narayan Kamath <narayan@google.com> Strip content length in requests with "transparent" gzip handling.

We need to strip both the Content-Length and the Content-Encoding
for such requests. In such requests, it will be the length of the
compressed response. We hide the fact that compression is taking place
from clients, so we shouldn't give them the content length either.

Change-Id: I80713ab33143945c5e2656f478d83cc9e60226a8
RLConnectionTest.java
dc24b1b274a6110a56993849c8e93033e0c2f1ff 21-Sep-2012 Jesse Wilson <jwilson@squareup.com> Add tests for underscores in URLs.

We're between a rock and a hard place on this. The RFCs say
that underscores aren't permitted in URLs. But browsers have
historically permitted them, and so there are websites that
depend upon them.

Attempting to support the de-facto standard rather than the
spec is difficult because support isn't universal. Mail servers
don't handle them. Internet Explorer loses cookies on them.

Further complicating things is that we can't easily support
underscores in hostnames in HttpURLConnection without also
adding support for that to java.net.URI. This would cause
awkward behavior in class that can be used for its strict
validation.

I'm recommending we stay spec-compliant. If its a major
problem for anyone, they can fix their servers.

Change-Id: I5135e0de20e11275e2459a67ec9e7c0d07b8a35b
http://code.google.com/p/android/issues/detail?id=37577
RITest.java
RLTest.java
3edd28a92fc86a1260347d0995e65a815d73bbbe 16-Apr-2012 Mattias Petersson <mattias.petersson@sonymobile.com> Fix problem with Runtime.runFinalization()

This is a fix for a problem with runFinalization(). The
problem was that all FinalizerReferences to objects that had
not yet been garbage collected were lost when calling this
function. When a FinalizerReference was lost, it is was not
possible to call the finalize() method when the object
was garbage collected.

The result was that finalizers was sometimes never
called, which typically lead to memory leaks.

Also stop synchronizing on the class itself; use a private
lock instead.

Bug: 6907299
Bug: 5462944 # Synchronization on FinalizerReference.class
Change-Id: Ief515edbb5a1823c06d7371415d131165baef7f2
RLConnectionTest.java
8155888a2c4e7cc28596deec28433e1984cfaf11 25-Jul-2012 Brian Carlstrom <bdc@google.com> Fix HttpURLConnection CloseGuard warning due to lack of close on GZIPInputStream

java.lang.Throwable: Explicit termination method 'end' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at java.util.zip.Inflater.<init>(Inflater.java:82)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:96)
at java.util.zip.GZIPInputStream.<init>(GZIPInputStream.java:81)
at libcore.net.http.HttpEngine.initContentStream(HttpEngine.java:523)
at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:831)
at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:274)
at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:486)
at ...

Bug: 6602529
Change-Id: I9b49cbca561f8780d08844e566820087fdffc4d7
RLConnectionTest.java
903b3f5b6a6e524cb4d88b83ea32e7c355392271 19-Jul-2012 Elliott Hughes <enh@google.com> Start removing Support_PortManager.

A bad idea, badly implemented.

Bug: 2441548
Change-Id: I34c990f6fd9d746771846f186a7ab3ab59e78a9f
ldDatagramPacketTest.java
ldServerSocketTest.java
ldURLClassLoaderTest.java
4ec2d0dea800397fb32227e0631246f4d2a73191 29-Jun-2012 Brian Carlstrom <bdc@google.com> HttpEngine should not attempt to cache proxy CONNECT responses

This fixes an issue where a bad proxy repsonse that included a body
would turn into an IllegalStateException instead of an IOException.

Bug: 6754912

Change-Id: I204ad975820693d6add2780d7b77360463e33710
RLConnectionTest.java
d56a81be1095021d3d5376293e5fcd28a2ee80ad 04-Apr-2012 Elliott Hughes <enh@google.com> Merge "Add a test for an already-fixed publicly-reported bug."
deb26711801f9bfafcd5cad20963b3c3913404fd 04-Apr-2012 Elliott Hughes <enh@google.com> Add a test for an already-fixed publicly-reported bug.

Bug: http://code.google.com/p/android/issues/detail?id=28095
Change-Id: I26ff2834becce6f51e668ec71b4e5050b15f06cd
RLConnectionTest.java
3d74b4bec8543e6e3f89eafe3afe0925f3a69f01 28-Mar-2012 Brian Carlstrom <bdc@google.com> Disable TLSv1.1 and TLSv1.2 by default

Bug: 6234791

Change-Id: I5d829211c9e1d5672fc96e42ef603c53d789e695
RLConnectionTest.java
3e6dd45baa0d7f9b4fa06f4ade76e088b59cc7bf 16-Mar-2012 Brian Carlstrom <bdc@google.com> Tracking openssl-1.0.1

Bug: 6168278

Change-Id: I240d2cbc91f616fd486efc5203e2221c9896d90f
RLConnectionTest.java
796f0d5a4e7b83c3efc5e587b6766977dc20b0c3 16-Feb-2012 Elliott Hughes <enh@google.com> Fix asynchronous interruption of Socket.connect with a timeout.

Turns out there was one connect variant I hadn't properly addressed.

Bug: http://code.google.com/p/android/issues/detail?id=24318
Change-Id: I7af697bdf6ea17ad1f8ea904d7d8a051ffb970d2
oncurrentCloseTest.java
df29c7dc69965462cd19de8910b04c8cb463e57f 15-Feb-2012 Jesse Wilson <jessewilson@google.com> Don't attempt to parse an HTTP response body on HEAD requests.

Previously if the response had a Content-Length or Transfer-Encoding
header we assumed it had a body. This was untrue of HEAD requests.
This is not a regression.

Bug: http://code.google.com/p/android/issues/detail?id=24672
Change-Id: I264db2014e681a6f8e93cd40b0f1640c95103d21
RLConnectionTest.java
e50d82455c813210a2d452070f45fd38d9903159 08-Feb-2012 Elliott Hughes <enh@google.com> Fix an ICS DatagramPacket bug.

Bug: http://code.google.com/p/android/issues/detail?id=24748
Change-Id: Iafab3a6c55007a47b68af5581148f5556f2fc808
ldDatagramSocketTest.java
58d229ebb70c7f6018e7b39c004638b9bdd62e31 26-Jan-2012 Jesse Wilson <jessewilson@google.com> Merge commit 'f41105dc' into manualmerge

Conflicts:
luni/src/test/java/libcore/java/net/URLConnectionTest.java

Change-Id: I8f2bd79b02d1c3315e97e36a59497054ec3e1dc2
a468471e8ccc2f642d5b2ae3c75873a74267ece2 26-Jan-2012 Jesse Wilson <jessewilson@google.com> Don't throw needlessly when returning the CacheResponse.

We were throwing under the premise that we'd always have
response headers before we had a cached body. But when the
user calls connect() we'll have queried the cache but we
won't necessarily have response headers from the server yet.
That's because connect() doesn't require a response to be ready.

Bug: http://b/5920659
Cherry-picked from: I9d69b44b5be3d0e29f14d8b83781f6e65c67582a

Change-Id: Ia403b42ddc9783fd1456164f4b7350da3ce80566
RLConnectionTest.java
fa5e8dfe3c7ed144b0fbe69091628dedd6a3b961 21-Dec-2011 Jesse Wilson <jessewilson@google.com> Don't reuse an SSL socket if the socket factory has changed.

Bug: http://b/3042192
Change-Id: Iaa9deb69058afcca4ab79ca6ba745c55d1e9321a
RLConnectionTest.java
abe4e615f473b387b1c00a738062a7c428f05a33 20-Dec-2011 Jesse Wilson <jessewilson@google.com> Unit test SSL fallback.

Bug: http://b/4462288
Change-Id: I9a29c70b24f235df15aa9a763ae5217e10e42f83
RLConnectionTest.java
5757cb35ad2e58d7accb7f5d3db6f2d5e72f097d 16-Dec-2011 Jesse Wilson <jessewilson@google.com> Support multiple challenges for HTTP authentication.

This fixes the problem reported in the bug, but we still need
to give attention to the digest scheme. Currently we can't do
Basic auth if the HTTP response contains both a Digest challenge
and a Basic challenge!

Bug: http://code.google.com/p/android/issues/detail?id=19081
Change-Id: Ifffb307678c2afa0db1d50c1ef5fc49ec7769306
RLConnectionTest.java
b2b02ac6cd42a69463fd172531aa1f9b9bb887a8 15-Dec-2011 Jesse Wilson <jessewilson@google.com> Change the way we cope with stale pooled connections.

Previously we'd attempt to detect if a connection was stale by
probing it. This was expensive (it relied on catching a 1-millisecond
read timing out with a SocketTimeoutException), and racy. If the
recycled connection was stale, the application would have to catch
the failure and retry.

The new approach is to try the stale connection directly and to recover
if that connection fails. This is simpler and avoids the isStale
heuristics.

This fixes some flakiness in URLConnectionTest tests like
testServerShutdownOutput and testServerClosesOutput.

Bug: http://b/2974888
Change-Id: I1f1711c0a6855f99e6ff9c348790740117c7ffb9
RLConnectionTest.java
2d9fa917aae6a6da38e9d1eda05841ffdf8855bb 15-Dec-2011 Jesse Wilson <jessewilson@google.com> Document the effect on timeouts of having both IPv4 and IPv6 addresses

Bug: http://b/3441111

Change-Id: Ib4c2e3e0d8d86eb5eb77cf92a0814c7444fd153f
RLConnectionTest.java
38af3fcf15a4e01f6557100b5328f479c3443e4d 14-Dec-2011 Jesse Wilson <jessewilson@google.com> Don't use ".local" if the local host name is fully qualified.

Running this test on the host will otherwise fail because the
host machine had a hostname like ridgeview.corp.android.com,
which doesn't match the ".local" domain.

Change-Id: Id81b01a4b87bb301fce1d7d64b6501990b9934c3
http://b/3041920
ookiesTest.java
0613de89655e481fa610bfd4f1bcaeeae3272205 14-Dec-2011 Jesse Wilson <jessewilson@google.com> Document that disconnect() doesn't release sockets.

We could make disconnect() work, but it's a lot of complexity for
little gain. The core problem is that by the time the user calls
disconnect(), the connection has already been pooled. On the RI,
disconnect() will close a socket connection if it hasn't yet been
removed from the pool. Our pooling always-on or always-off behavior
is simpler and more predictable.

Bug: http://b/4148042
Change-Id: I61ef2ccb898f3ffaa08cedc70ee9e728fc1889b9
RLConnectionTest.java
b416ef5dc224630af2b9393a15ae120b27e4864a 14-Dec-2011 Jesse Wilson <jessewilson@google.com> Rename SerializableTester to SerializationTester

Change-Id: Idfaea5c474eb3cabfb8eefc5aa25a7ff0cce26ea
netAddressTest.java
RITest.java
RLTest.java
10078dabb17441ce2721a8e5e10f275c5d0a426a 13-Dec-2011 Jesse Wilson <jessewilson@google.com> Kill SerializationTester; obsoleted by SerializableTester.

Bug: http://b/5397460
Change-Id: Ic20f4363c8937d5feff0dec89e5de7ccf20f1dac
netAddressTest.java
b1c31fbbba0ff96366b35ab40fd49cce55c9f489 25-Nov-2011 Jesse Wilson <jessewilson@google.com> Test for available() returning 0 when the input is exhausted.

This test typically fails before 3 reps. I've seen it run as many
as 30 reps before it fails. It probably isn't a problem with libcore;
the test also fails on the RI after several reps.

Change-Id: I28cc109898dbfcadd2ed434dd9d590ebd22c9596
http://b/5534202
ocketTest.java
d0d626655f1d452070d3116678037e8759f807f4 10-Nov-2011 Jesse Wilson <jessewilson@google.com> Don't NullPointerException when a URL contains a space.

We end up creating a URI of http://and%20roid which has no host
name part because and%20roid is not a valid host name. It's unclear
where the best place to fail is. This is consistent with the RI
which doesn't fail until it attempts to connect.

Bug: http://code.google.com/p/android/issues/detail?id=16895
Change-Id: Ifa4dc3c651f4627e27622ed5cedfa820f9a35358
RITest.java
RLConnectionTest.java
RLTest.java
ec8de076ac382cded43952ba0c2972282b09e1c7 24-Oct-2011 Elliott Hughes <enh@google.com> Fix socket timeout test failures.

The kernel uses awkward device-specific units that make tests with timeouts
that aren't integer multiples of a second awkward.

There's no common superclass for the various sockets, so we can't factor
out the test even though -- apart from the creation of the specific socket --
it's textually identical in each case. Nice library design, boys!

I've also fixed a couple of CloseGuard warnings in passing.

Bug: 5159133
Change-Id: Iaf4c9891b3cf2f5b3ebcee5cb2ba862157ab034e
ldDatagramSocketTest.java
ldServerSocketTest.java
ldSocketTest.java
04e25f30524dc7b51f280912d6ca97d991ae84b0 24-Oct-2011 Elliott Hughes <enh@google.com> Fix socket timeout test failures.

The kernel uses awkward device-specific units that make tests with timeouts
that aren't integer multiples of a second awkward.

There's no common superclass for the various sockets, so we can't factor
out the test even though -- apart from the creation of the specific socket --
it's textually identical in each case. Nice library design, boys!

I've also fixed a couple of CloseGuard warnings in passing.

Bug: 5159133
Change-Id: Iaf4c9891b3cf2f5b3ebcee5cb2ba862157ab034e
ldDatagramSocketTest.java
ldServerSocketTest.java
ldSocketTest.java
bdd37a76ddfd92d6716127e025ba9cf733e66fc4 30-Sep-2011 Jesse Wilson <jessewilson@google.com> Merge "Fix chunked input stream's available() method to never return -1."
25a753691a80186cd4d7086b12c0e52225d95897 30-Sep-2011 Jesse Wilson <jessewilson@google.com> Fix chunked input stream's available() method to never return -1.

Change-Id: I6ea268e469675ef890010282dbe35ed5838cca73
http://code.google.com/p/android/issues/detail?id=20442
RLConnectionTest.java
9b4a8ec37805be3eabf3a4b443bbdb692ffa2608 30-Sep-2011 Elliott Hughes <enh@google.com> Fix a couple of isReachable bugs.

We shouldn't throw NPE if you call isReachable on a deserialized InetAddress.
Fixed by removing the "globals", which also fixes the unreported bug that
calling isReachable on the same InetAddress was not thread-safe.

Bug: http://code.google.com/p/android/issues/detail?id=20203

Also, the arguments to isReachableByTCP in isReachable(NetworkInterface, int, int)
were the wrong way round, which meant we'd always return false (unless you were
asking if localhost was reachable).

Bug: http://code.google.com/p/android/issues/detail?id=20107

Bug: 2497441
Bug: 3213503

Change-Id: Ic808e774c28be6487e30e6acb8bc06f766f5c71d
netAddressTest.java
a7428d68453f6a74633221e8714f8d3d9597b2b4 29-Sep-2011 Elliott Hughes <enh@google.com> Fix the InetAddress/Inet4Address/Inet6Address documentation.

Also simplify a few of the implementations, and add a few tests.

Bug: http://code.google.com/p/android/issues/detail?id=19165
Change-Id: If33d5a830068114edf722711333bf0e00098d91a
netAddressTest.java
51a2a0fe51532ca5f3ce872295e6de253eac07bf 18-Aug-2011 Jesse Wilson <jessewilson@google.com> Permit file:///foo or file:/foo

Change-Id: Ib1d256a1aa6cb74e09f183263bb0f3e40b103e4f
ldJarURLConnectionTest.java
b2e8faf476945177350f5480944ffca6ffcea3b2 16-Aug-2011 Jesse Wilson <jessewilson@google.com> Don't let a helper thread die with an exception.

This was causing the test to fail on CTS.

Change-Id: I43a55620e702d4693eb4f8df2791ec7bba8d8390
ldDatagramSocketTest.java
0631922690f57fc2d7ae14f26fc6d721a08ae6b4 29-Jul-2011 Jesse Wilson <jessewilson@google.com> Merge "Only permit square brackets on IPv6 addresses."
98c564c72480313ae2954a7f0b666ff94345a2f1 25-Jul-2011 Jesse Wilson <jessewilson@google.com> Only permit square brackets on IPv6 addresses.

We were failing two tests in URLTest because we were accepting
IPv4 addresses and host names.

Note that in the RI, URL is extremely lenient on validating the
characters in the parts of a URL. It permits any character in any
part except for the delimiter characters like '/' or ':'. The
lax IPv6 check 'does it contain a colon?' is consistent with the
RI.

Change-Id: I957f2ee610b72cf68a7773b4c02a4b6d5fcbb9de
RLTest.java
d9624e23a39f2ddf32dc51c3dabf60998567e762 25-Jul-2011 Jesse Wilson <jessewilson@google.com> Fix overly-strict cookie test.

My intention in this test was that derived headers were
passed to the cookie handler. I recently refactored the
HTTP client and some headers are now set very late; I need
to adjust this test's expectations to match.

Change-Id: Id605a213defaa25c0355ee581997233383658420
ookiesTest.java
7f708078fcc35e4b301469a0b124806996fe0399 08-Jun-2011 Jesse Wilson <jessewilson@google.com> am fd92a508: Merge "Use external/mockwebserver in libcore"

* commit 'fd92a50839c5327c5d32d65315fde5d52c9da03d':
Use external/mockwebserver in libcore
09336c914b4fc813e493acc82469b9ad89fd8694 07-Jun-2011 Jesse Wilson <jessewilson@google.com> Use external/mockwebserver in libcore

Change-Id: I4dac34f88b23484643bce31e5f25ac6eb1fea426
ookiesTest.java
RLConnectionTest.java
686dd6f676dc348ac260f54e544cf8d813df64a9 07-Jun-2011 Elliott Hughes <enh@google.com> Remove dead tests.

Change-Id: Ife89885ea95de3bb2617172b95cdfd46d586a644
ldNetPermissionTest.java
ldSocketPermissionTest.java
ldURLClassLoaderTest.java
c320b4381faed584a33ed69f53076dd32193144d 06-Jun-2011 Elliott Hughes <enh@google.com> Clean up test duplication and fix broken tests.

Change-Id: I22bbc320536d7f4d862102d3962b521d26e30a9f
netSocketAddressTest.java
fc041ff241f9a7556e72236f130de0215ecd17db 03-Jun-2011 Elliott Hughes <enh@google.com> Remove support for deprecated IPv4 address formats.

Bug: 4539262
Change-Id: Ic42173b7b06e8536e8c4331087720d7df1e1681a
netAddressTest.java
ecf950e56b55f95a960f151268286576159c6530 27-May-2011 Jesse Wilson <jessewilson@google.com> Relative/absolute and opaque/hierarchical docs for java.net.URI.

Change-Id: I5ec2e1dd10a3c676441caf56838433fffa316a59
http://b/2753295
RITest.java
c68609e723a5daa20888abdb640799d4353fd590 27-May-2011 Jesse Wilson <jessewilson@google.com> Document java.net.URI.

Change-Id: I941ba9cb4a2d48b052c25b7799ac466549df8d53
http://b/2753295
RITest.java
RLTest.java
ce257b03a1e5ff6075967e6a84cdb439cb2b01c8 27-May-2011 Jesse Wilson <jessewilson@google.com> Clean Up URI's parsing code.

http://b/2753295

Change-Id: I190ee12c14d1b3b17e2c8cb5ef3868618f1ee124
RITest.java
2d99ef561304174b8ae01a0a68d5b96d5edb9f10 26-May-2011 Jesse Wilson <jessewilson@google.com> Fix URI to behave more like the spec and browsers and less like the RI.

When computing relative paths from URLs like foo.com/a to foo.com/a/b,
this now uses "a/b" as the relative path and not just "b". That was an
RI bug that we were foolishly compatible with.

Change-Id: I6e3f10d84602c08bbf6bd7c7e43c2ba3387e4c3b
http://b/2753295
RITest.java
98879fb0ca920d752fce6177b6832293323e0944 26-May-2011 Jesse Wilson <jessewilson@google.com> Merge "Parity between URI and URL tests." into dalvik-dev
10527ac8763cc50fa9eca0d4ce495909899f0b9a 25-May-2011 Jesse Wilson <jessewilson@google.com> Parity between URI and URL tests.

Duplication here is unfortunate. It would be a lot of work
to share tests here, since the two classes have necessarily
different behaviors in certain situations. I continue to work
on making the two classes consistent with browsers, which
means they'll be more consistent with each other.

Change-Id: Ic33c414abe1344cdfd1a9b539d9918dcd074f2c6
http://b/2753295
RITest.java
RLTest.java
riTest.java
5bf7fa5b431ebfa093c2a389148be3faa62e8237 25-May-2011 Elliott Hughes <enh@google.com> More Harmony test consolidation.

Change-Id: I98070d03c8b5f5764d54e3d2058c5707bbb954ce
netAddressTest.java
19fa10017f9f8904dea97afcb48caf13d8c2dde2 25-May-2011 Elliott Hughes <enh@google.com> Deduplicate Harmony tests.

Change-Id: I42b6b960660402e701552dceec4ea616955bc23f
netAddressTest.java
5292410e4ebf7fb5149eefd2f52fcb94c46690a6 24-May-2011 Jesse Wilson <jessewilson@google.com> Rewrite parsing for java.net.URL.

This fixes many broken cases on handling relative URLs.

We normalize all URLs by default. This will result
in more URL equality than before. Previously the URLs
http://android.com/a/../ and http://android.com/ were not
equal; now they are equal.

Change-Id: I8cf7be2e42eeb1386520be2698d8f14e0a55decb
http://b/4361656
ldURLStreamHandlerTest.java
ldURLTest.java
RLConnectionTest.java
RLTest.java
548d2e6ef6d2f4334a488cac591d11e60675111a 24-May-2011 Elliott Hughes <enh@google.com> Remove two tests that are duplicated in the Harmony suite.

(And a spurious blank line from ThreadGroup.)

Change-Id: I3cb1ccb94a8352937d221a141a598ffe4696b06e
ldDatagramSocketTest.java
8f99aa098c6a06b8be788abbca1c1d1060342709 21-May-2011 Jesse Wilson <jessewilson@google.com> Cosmetic cleanup of java.net.URL.

Update the documentation to be closer to reality.

Change-Id: Ic187efde5d83c6bfcdc80428429a2d0f186d9d0a
http://b/2753295
RLTest.java
ec6163ceac64902ccde3259e8a426f0f9ad6a88c 20-May-2011 Jesse Wilson <jessewilson@google.com> Add test cases inspired by Jetty-dependent Harmony tests.

Change-Id: Id8288e0524b64255c5d9808d3f5582708211d96b
RLConnectionTest.java
23ec09188303a874b3b391f96ae0a29af002bff9 19-May-2011 Elliott Hughes <enh@google.com> Implement recvfrom(2).

This one's a little bit hairy because of multiple return values.

Bug: 3107501
Change-Id: I3bd35647d94bb6bc2192d6f31a39ecca07a3926e
ldDatagramSocketTest.java
a7dfae9c0c4d704add6211d6419408ae27709169 17-May-2011 Jesse Wilson <jessewilson@google.com> Remove an obsolete HTTP response caching test.

Change-Id: Ib39e2c9a4a968074abea879715cbafb5ae030056
http://b/3180373
ldResponseCacheTest.java
757afaa7afe96791a3cc612c9e3c4597a7321c7e 12-May-2011 Jesse Wilson <jessewilson@google.com> Provide hit and miss stats on the HTTP response cache.

Also capture FDs rather than InputStreams when a cache
entry is read. This permits the cache to return as many
streams as the caller requires.

Also fix bugs where we weren't properly releasing the
input streams from the responses.

Change-Id: I04807eab648864229f1e8734ad1fbb6a2d6bb51d
http://b/3180373
ttpResponseCacheTest.java
433e3fac172d0c4449051b0c61c0c63b298a0903 11-May-2011 Jesse Wilson <jessewilson@google.com> Adopt DiskLruCache in HttpResponseCache.

http://b/3180373

Change-Id: I55ed45c5d0b8fc72cf50e8912416367ac802dc7a
ttpResponseCacheTest.java
0654e2f57f1661df3a37374664703760da24842a 09-May-2011 Elliott Hughes <enh@google.com> Merge "Expose bind(2)." into dalvik-dev
da15009528cc8300a6251f1d0931ac8657c9fc31 09-May-2011 Elliott Hughes <enh@google.com> Expose bind(2).

I've renamed the java.net.InetAddress to struct sockaddr conversion functions
too, after initially screwing up this patch by copy & pasting a usage of the
one that only one caller actually wants. Now the name's so ugly no-one will
be likely to use it by accident.

Bug: 3107501
Change-Id: I869a8d27fc40e462505e02bf25a67e771a403e92
ocketTest.java
73257349d5fd9aef202e621537ec3aae598e01ee 09-May-2011 Jesse Wilson <jessewilson@google.com> am 1e518e80: Deduplicate a unit test merged in from upstream.

* commit '1e518e80aeb8c27d49d51e5c69173d3e08fb9ec7':
Deduplicate a unit test merged in from upstream.
1e518e80aeb8c27d49d51e5c69173d3e08fb9ec7 09-May-2011 Jesse Wilson <jessewilson@google.com> Deduplicate a unit test merged in from upstream.

Change-Id: Ia5f4ad1753fa6bb2ce4dd5fdf4c978e1ff0ffa80
http://b/4188137
RLConnectionTest.java
eda815b907ced9d2416e85cc2dbd2977b7540e4f 09-May-2011 The Android Automerger <android-build@android.com> am 0b1bf8f9: am 0d25f5b7: am 162efaf6: manual merge

* commit '0b1bf8f94989d5b1213b79b70a5a0e0050bd8b76':
Fix the byte order of non-ByteBuffer duplicate and slice results.
Don't read from the delegate stream after we close it.
Fix asReadOnlyBuffer to conserve the byte order (on everything except ByteBuffer).
0b1bf8f94989d5b1213b79b70a5a0e0050bd8b76 09-May-2011 The Android Automerger <android-build@android.com> am 0d25f5b7: am 162efaf6: manual merge

* commit '0d25f5b79484f6467f7d24177833ef1be2c2e9cb':
Fix the byte order of non-ByteBuffer duplicate and slice results.
Don't read from the delegate stream after we close it.
Fix asReadOnlyBuffer to conserve the byte order (on everything except ByteBuffer).
162efaf627ce3571b4897fd685f032ab6a626c5b 09-May-2011 The Android Automerger <android-build@android.com> manual merge

Change-Id: I3a56929a85f42173003fc53091c6592d4a4a824e
a29cfae03ee194774639c8ee7d2d69747caeacfb 07-May-2011 Elliott Hughes <enh@google.com> Test fixes.

There are many IPv4 loopback addresses in addition to IPv6's single one.

You can't connect from a mapped IPv4 address to an IPv6 (it times out), so
fix the EADDRINUSE test to finish a lot quicker.

Change-Id: Ifdc483683fa79b2adc7efb8de1b1f24efdfdc464
ldSocketTest.java
49ff8b8582bca20a1adbda1d957220526332a8ca 06-May-2011 Elliott Hughes <enh@google.com> More networking cleanup.

Move a bit more work into Java.

Change-Id: I656ec6e3c792ce9baed32662d65c45d75af1d371
erverSocketTest.java
9531eea15052eccc004b5f853ab4452becf7a8ab 06-May-2011 Jesse Wilson <jessewilson@google.com> Test that headers aren't accidentally transferred across requests.

We used to have a bug where we'd only ever add headers. So if
a request was redirected from a.com to b.com to c.com, then
c.com would be able to see cookies from the other two hosts.

This was fixed by the HttpEngine refactor, but tests haven't
been added until now.

Change-Id: I01588fe9662aae7404fef4d4b2c4f0468e7c670d
http://b/3180373
ookiesTest.java
ttpResponseCacheTest.java
5e8b5a55eda914b67c62b4e77152922d5c77eb68 29-Mar-2011 Jesse Wilson <jessewilson@google.com> Don't read from the delegate stream after we close it.

Honeycomb MR2 patch cherry-picked from bc4c79c6a2059003f695f7ad204de36700e8d701

Change-Id: Ib379595a1e6b2ed3b16d4d82c744b00e4b576c51
http://b/4188137
RLConnectionTest.java
2f16d502415452f808b5f077ad07b941645d14e4 06-May-2011 Jesse Wilson <jessewilson@google.com> Support Cache-Control 'must-revalidate' directive.

Change-Id: I98094e90307e7a39e40de6a09f34f038ad143ea4
http://b/3180373
ttpResponseCacheTest.java
c996149b500fc4825156106554457fe2394ae087 06-May-2011 Jesse Wilson <jessewilson@google.com> Fix proxy+HTTPS to handle authentication requests from the proxy.

Previously I'd introduced a bug by assuming that CONNECT
responses would always be successful.

Change-Id: Iaf0caf67f52154f6951a20284c75db0090843b99
http://b/4188137
RLConnectionTest.java
19c77c6a6da8cea7327ccbb741963ac76d3fae53 05-May-2011 Jesse Wilson <jessewilson@google.com> Address some test failures in the HTTP client.

Change-Id: I44783aa7cadd51ed6b9e7aabc94144c60252c095
http://b/3180373
ttpResponseCacheTest.java
73c54e43051d0da126d643049296c264ebb9fd04 05-May-2011 Elliott Hughes <enh@google.com> Merge "A handful of networking test fixes." into dalvik-dev
d742d7fc7f0593eb8c6e4ac9dd4c0f6a80374e46 05-May-2011 Jesse Wilson <jessewilson@google.com> Use GET after a POST is redirected.

Also dropping support for response code 305 Use Proxy, which
is seldom used, and whose behavior is quite different from
Chrome and Firefox. This is an intentional delta from the RI.

Also testing disconnect().

Change-Id: I80433f4776a2cfc5e228179421a787a44a4ded69
http://b/3180373
RLConnectionTest.java
a4193d7e636802a2705ffb52cb69c69ff59bfbb2 05-May-2011 Jesse Wilson <jessewilson@google.com> Clean up HTTP engine connection reuse.

Also fixing cached responses to set warnings on the
response header and not the request header.

Change-Id: I4def2abf00e43aedc4baa63d1624bfa2f4d9bc16
ttpResponseCacheTest.java
ce1150d9897bd5baf66de4a8db132afce18be15a 05-May-2011 Jesse Wilson <jessewilson@google.com> Merge "Refactor HttpURLConnection implementation." into dalvik-dev
953df613522e12a418cb7cb73248594d6c9f53d4 03-May-2011 Jesse Wilson <jessewilson@google.com> Refactor HttpURLConnection implementation.

Break HttpURLConnectionImpl into two parts: the part that
implements the Java API (that follows redirects etc.) and
the part that speaks HTTP. The HTTP part is called HttpEngine,
and it can only be used for a single HTTP request. This makes
it easier to set request properties that only apply to a
single socket request.

Tests for 'Vary', 'Content-Location' and warnings.

For simplicity of implementation I've chosen not to support
'Vary' at this time.

The 'Content-Location' header doesn't require any work from
the cache.

Warnings are ugly but allow the caller to identify when the
cache results may be problematic.

Also breaking HttpResponseCache's dependency on HttpURLConnectionImpl
so it can be tested on the RI.

Change-Id: Idbabb51251f479c2cdea4e0fceb029bfd07182be
http://b/3180373
ttpResponseCacheTest.java
RLConnectionTest.java
7e6cee7a973ebf3cdc32638580d777d9b45088ae 05-May-2011 Elliott Hughes <enh@google.com> A handful of networking test fixes.

The main thing is that some of the tests were relying on the presence of the
removed "java.net.preferIP*" properties.

Change-Id: I4cb1e99a13ed10c3ce14dad58579454a22b3416f
ldDatagramSocketTest.java
ldSocketTest.java
1c039d71d3879f39e3a75b8788e656f7b4f88f08 05-May-2011 Elliott Hughes <enh@google.com> Add getaddrinfo(2).

This only supports the "node" side of getaddrinfo(2), not the "service" side.
There's also no support for AI_CANONNAME, so we currently return InetAddress[]
rather than anything equivalent to C's linked list of struct addrinfo.

Bug: 3107501
Change-Id: I8cf6baa3027a0fa05ac6e2f8fcc1dd8b576ff8c4
netAddressTest.java
21dddca4064527116af7a1553de502c6d11138da 03-May-2011 Jesse Wilson <jessewilson@google.com> Cache authorization headers and default expiration date.

Neither of these are particularly pretty. Authorization is a
silly special case in the spec that makes caching opt-in rather
than opt-out. Default expiration dates are reasonable but require
a hack to not cache get queries like http://foo.com/?q=bar.

http://b/3180373

Change-Id: Ica76ccfde30fe1e7a0d64895ef5370b43bd980ec
ttpResponseCacheTest.java
84f1fd18b9db6fc6f2bb65694bee99d42f88bb79 02-May-2011 Jesse Wilson <jessewilson@google.com> Honor client conditions in HTTP response caching.

Also whitelist acceptable response codes and use the same
logic in both the write-to and read-from cache code paths.

Change-Id: I9500c6c2c0f9bb35e05e2a3443542a86de76cb66
http://b/3180373
ttpResponseCacheTest.java
c9e12f729cb962eb60754e4500312421c46e71dd 30-Apr-2011 Jesse Wilson <jessewilson@google.com> Adding support for only-if-cached request header.

This is somewhat ugly because it means we need to fake a 502 bad gateway
status when the response would otherwise be a cached or conditionally
cached result.

Also adding support for max-stale. This completes the set of three
client cache timing headers, max-age, min-fresh and max-stale.

Change-Id: I923a3e5a4685989cb49fb57d6a1359e10026b94b
http://b/3180373
ttpResponseCacheTest.java
adb64fbba2b781467e055706c3de0873dfc01166 30-Apr-2011 Jesse Wilson <jessewilson@google.com> Honor max-age and min-fresh request headers.

We now honor headers from both the server's response (which
we have cached) and the client's request.

Change-Id: Ib46e4fc0c5dd5b3e74cff8f45eea2dda51d20b94
http://b/3180373
ttpResponseCacheTest.java
9b35d1ad04cdaf0905aee3cb04064ba977e846ac 29-Apr-2011 Jesse Wilson <jessewilson@google.com> Improve parsing of HTTP caching headers.

Change-Id: Ie2b4c76ac97cc7a4783bd6a695cfb28f7ea2296f
http://b/3180373
ttpHeadersTest.java
0c59055dd24e1659f85d9ff7e2148883f663bd62 27-Apr-2011 Jesse Wilson <jessewilson@google.com> Support conditional gets in HttpURLConnection.

This is the first step towards adding an HTTP response cache.
There's still much to do; details are listed on the bug.

Change-Id: Ie693fe424d1d90e90576fc959595e4d96a31f767
http://b/3180373
ttpResponseCacheTest.java
RLConnectionTest.java
a37e971343883bb582a93ffbd9f0ba84f10e55ba 21-Apr-2011 Elliott Hughes <enh@google.com> Rewrite NetworkInterface.

This is part of the POSIX work, but also fixes a bug that asked for down
interfaces to be returned. Additionally, I found a few bugs while rewriting
this code. Most notably, we used to return a bogus broadcast address for
the loopback interface. The only difference I notice between us and the RI
when running on the host is that the RI claims that 127.0.0.1 has a prefix
length of 0 rather than 8. I believe that we are correct on this issue.

Bug: 4082343, 3107501
Change-Id: I677e0698e3a86676b4332b5d56fe514a99c3ddc0
etworkInterfaceTest.java
775095bf6a763e6a9b4e858011a812425d949af5 20-Apr-2011 Elliott Hughes <enh@google.com> Remove an unnecessary special case in InetAddress.getAllByName.

(And add a test to ensure it remains unnecessary.)

Change-Id: Ia1b4f0721308a36d972da36c06869ce4740b1cda
netAddressTest.java
5194e8e5a510c946cb82d5ff6943f52ada6850cc 05-Apr-2011 Jesse Wilson <jessewilson@google.com> am 5f03a468: Fix a test that was merged from both GB and HC.

* commit '5f03a4682a71e56535059258a4d41150b99177d7':
Fix a test that was merged from both GB and HC.
46323d951751fbb32df7fe2e3c10192b8b6e52cf 05-Apr-2011 Jesse Wilson <jessewilson@google.com> am d3226243: am cb6cd460: am f241d462: Don\'t read from the delegate stream after we close it.

* commit 'd3226243e9e634779f8f66cdadaaee31ece24eaf':
Don't read from the delegate stream after we close it.
5f03a4682a71e56535059258a4d41150b99177d7 05-Apr-2011 Jesse Wilson <jessewilson@google.com> Fix a test that was merged from both GB and HC.

Change-Id: I8cf7dec2dcec177669a04951635c95c78d8c7aaf
http://b/4188137
RLConnectionTest.java
d3226243e9e634779f8f66cdadaaee31ece24eaf 05-Apr-2011 Jesse Wilson <jessewilson@google.com> am cb6cd460: am f241d462: Don\'t read from the delegate stream after we close it.

* commit 'cb6cd4609ea81a1288a5c754a2a42d6ce7acb842':
Don't read from the delegate stream after we close it.
9fa7c4cd4a619236db70aefab8da3abafb065bca 31-Mar-2011 Jesse Wilson <jessewilson@google.com> am 866b399e: am 9d28a32d: am bc4c79c6: Don\'t read from the delegate stream after we close it.

* commit '866b399e1d5cab4cc8d196f8008ba8ad8376765d':
Don't read from the delegate stream after we close it.
bc4c79c6a2059003f695f7ad204de36700e8d701 31-Mar-2011 Jesse Wilson <jessewilson@google.com> Don't read from the delegate stream after we close it.

Change-Id: Ib724b170f7ec10ea0025c0e2e7978119fd070eb6
http://b/4188137
RLConnectionTest.java
0c2fd828abec671333b8b88281825fd27a783723 30-Mar-2011 Jesse Wilson <jessewilson@google.com> Fix MockWebServer to use the same hostname as TestKeyStore.

Change-Id: I31c9f6e9add87a17737eac4f09949540e5da8cb5
RLConnectionTest.java
f241d462634527692b7d99335cdc8c11883ac966 29-Mar-2011 Jesse Wilson <jessewilson@google.com> Don't read from the delegate stream after we close it.

Change-Id: I9a018ca88373d5f317335e35fc6ca43c5473490e
http://b/4188137
RLConnectionTest.java
c2ebff3511f9df4d8cca2b82630c2d760af9d204 19-Mar-2011 Jesse Wilson <jessewilson@google.com> Prefer the user's stream handlers to the built-in ones.

Apps may use this to install their own protocol handlers instead
of the default ones. This is used for HTTP NTLM authentication
in some libraries.

Change-Id: Icd5882e8ddd0545f897bee916150765e02929fc9
ldURLStreamHandlerFactoryTest.java
RLStreamHandlerFactoryTest.java
ustomstreamhandler/http/Handler.java
5aafac4db69e6d087c512cdfa5c7c0e2f1611681 19-Mar-2011 Jesse Wilson <jessewilson@google.com> Move URLConnection classes to libcore.net.

Change-Id: I14bf8373dfce50dda94e1a64419b9a8a9cf3c82e
ttpHeadersTest.java
5d3f5562c167120b5ec00e509af0f0ab9308bff5 04-Mar-2011 Elliott Hughes <enh@google.com> Add InetAddress.getLoopbackAddress.

Bug: 3484927
Change-Id: Ic5305c852ed8079d958d8ab7c46fe10cceac60d4
netAddressTest.java
229e34b182b98e1dba15d3dc6341954986ae2b7a 03-Mar-2011 Brian Carlstrom <bdc@google.com> Removing use of @tests and @Test.* annotations

Change-Id: I89243efdeebe22543c45a2166b634f40c3e78cf8
ldURLClassLoaderTest.java
93942160263480b1ffdd4030036cf6994c616b9c 24-Feb-2011 Elliott Hughes <enh@google.com> am 46bed6a4: Make InetAddress.parseNumericAddress more like InetAddress.getByName.

* commit '46bed6a47a20d8105f0e099d162d547a7964b4fe':
Make InetAddress.parseNumericAddress more like InetAddress.getByName.
46bed6a47a20d8105f0e099d162d547a7964b4fe 24-Feb-2011 Elliott Hughes <enh@google.com> Make InetAddress.parseNumericAddress more like InetAddress.getByName.

Specifically, treat null and "" as requests for the loopback address.

Bug: 3483011
Change-Id: I656f1d2873faf4b73e1fc7621c96183a8a86992b
netAddressTest.java
f5fc66d0a21d4369e17e14d4a86d1a7b2d2678b2 23-Feb-2011 Jesse Wilson <jessewilson@google.com> Merge commit '6dfa1ea0' into manualmerge

Conflicts:
luni/src/test/java/libcore/java/net/URLTest.java

Change-Id: Idcc92efa678d32ec1c9fa22bc6877f9582ff319e
6c434a1215049a76ba82fea69e8c5aa76cad955b 21-Feb-2011 Jesse Wilson <jessewilson@google.com> Fix URL.equals() to not throw on null hosts.

Change-Id: Ib89c902a10b28dc7e78600b44a3f1ff230f9b553
http://b/3474668
RLTest.java
8efab4cc6c0dd46712e4ca80d9cb851dd5bbf6c2 16-Feb-2011 Elliott Hughes <enh@google.com> am ede17863: Better tests for InetAddress.parseNumericAddress.

* commit 'ede17863e71079d082ff8fb9d1d6f8299bea04b6':
Better tests for InetAddress.parseNumericAddress.
4ffe5900ca8922ad33639f9f73cb30b8f6721363 16-Feb-2011 Elliott Hughes <enh@google.com> am f39b892d: Add InetAddress.parseNumericAddress for frameworks/base\'s benefit.

* commit 'f39b892d87e85835f021e8ad77ffdd215735604b':
Add InetAddress.parseNumericAddress for frameworks/base's benefit.
ede17863e71079d082ff8fb9d1d6f8299bea04b6 16-Feb-2011 Elliott Hughes <enh@google.com> Better tests for InetAddress.parseNumericAddress.

Bug: 3300307
Change-Id: I1e230354185c2a4bf8c82ba70e3f93a2a738091a
netAddressTest.java
f39b892d87e85835f021e8ad77ffdd215735604b 16-Feb-2011 Elliott Hughes <enh@google.com> Add InetAddress.parseNumericAddress for frameworks/base's benefit.

Bug: 3300307
Change-Id: Ifb2207621232314046aee39fdb86b957b9e7f8fc
netAddressTest.java
786ca658dfe8596835859ce45ee3b0ed46b8f21c 10-Feb-2011 Jesse Wilson <jessewilson@google.com> Fix URL encoder regression.

My recent cleanup broke URL partial encoding when the source URL
already contained escaped sequences. It was covered by a test that
I didn't run! Sigh.

Also fold in related tests. The URL decoding tests were validating
that URLs were resolving IP addresses; that functionality has since
been removed.

Change-Id: I876db3459f413e3f20ac3fd757749d8fbee3a1eb
http://b/2753295
ldURLDecoderTest.java
ldURLEncoderTest.java
ldURLStreamHandlerTest.java
rlEncodingTest.java
32559028b14b9b321b10eede050afd554a376569 09-Feb-2011 Jesse Wilson <jessewilson@google.com> Use the same code to encode and fix poorly encoded URLs.

Don't permit digits outside of ASCII.

Change-Id: I47b756c32e67b7415e35ae9eb55b735d1c22a36d
http://b/3436051
RLConnectionTest.java
rlEncodingTest.java
56099d23fcb002b164bff8fb7f14d6ec0453509e 09-Feb-2011 Jesse Wilson <jessewilson@google.com> Remove redundant URL encoders and decoders.

http://b/3436051
http://b/2753295

Change-Id: I5836eab395214767efa4a3d8e8002cff72738854
rlEncodingTest.java
9773c9ed094e164ace98757bb6d54964ca8978fd 09-Feb-2011 Jesse Wilson <jessewilson@google.com> Put some tests in place before I delete some URL decoders.

Change-Id: Id78b5256b65f6f3f8e78eeb37633fb90ee27ae72
http://b/2753295
rlEncodingTest.java
52b939cbcc060c6bf71b65f2588e9837a86f7c5f 04-Feb-2011 Elliott Hughes <enh@google.com> Remove @Test cruft from all tests under luni/src/test/java/libcore.

Change-Id: I1c5a4f3109147830009d5fc1780e43ed875313ca
ldFileNameMapTest.java
ldResponseCacheTest.java
ldURLClassLoaderTest.java
ldURLTest.java
7e00db4156e50ce5f20fefb820dca339299134d3 30-Jan-2011 Jesse Wilson <jessewilson@google.com> Don't do DNS lookups in URL.equals()

Change-Id: Iea9becdb3a16eab054f9073719c77c2215ce0208
http://b/3045867
ldURLStreamHandlerTest.java
RLTest.java
38db242d16a5a31fd86c519b817ae94c5fc89417 27-Jan-2011 Elliott Hughes <enh@google.com> Consistently use "expected" for expected exceptions in our tests.

Change-Id: I796624fb53dbba420d43858741c9a97b4fb8d017
RLConnectionTest.java
08eee0f04268acee9d7f1cb8635a2c6ccd3bac51 21-Jan-2011 Jesse Wilson <jessewilson@google.com> am 980c8fb5: resolved conflicts for merge of e1c91159 to master

* commit '980c8fb5294de36c96713500703e5aee0120ade5':
Handle the CacheResponse returning a null body.
980c8fb5294de36c96713500703e5aee0120ade5 21-Jan-2011 Jesse Wilson <jessewilson@google.com> resolved conflicts for merge of e1c91159 to master

Change-Id: I7f6968670040b1dabfa9220baaae64abb9fcf40b
afd9b157f467b7c4f2f0b5592dca72f18d844602 20-Jan-2011 Jesse Wilson <jessewilson@google.com> Handle the CacheResponse returning a null body.

Change-Id: I45c4d6b7cac5cabd8c42f5e17d110fb5b3ecc9cc
http://b/3373699
RLConnectionTest.java
5d0cc20dcd910199ba613d912d9dad4876152930 20-Jan-2011 Jesse Wilson <jessewilson@google.com> am d63ca955: am 0e6ef4e7: am d5d70a00: Merge "Fix URL character bugs by adding yet another encoder." into honeycomb

* commit 'd63ca955dca5eaa786666e9d4d9b4e97ceb049ad':
Fix URL character bugs by adding yet another encoder.
d63ca955dca5eaa786666e9d4d9b4e97ceb049ad 20-Jan-2011 Jesse Wilson <jessewilson@google.com> am 0e6ef4e7: am d5d70a00: Merge "Fix URL character bugs by adding yet another encoder." into honeycomb

* commit '0e6ef4e70f9521ed475f6898055ac740cef2770e':
Fix URL character bugs by adding yet another encoder.
d1b5e5da828434388e486a388710d21e4306dae0 20-Jan-2011 Jesse Wilson <jessewilson@google.com> Fix URL character bugs by adding yet another encoder.

We don't have an encoder that ignores already escaped
characters.

Change-Id: I9ff080ad1745136b7d7313d78af2b0ca1785b200
http://b/3360947
RLConnectionTest.java
3e16a1a4bc2e092cda4de2977157cff082682fd7 14-Jan-2011 Jesse Wilson <jessewilson@google.com> am 1c3170be: am 2d6d9bc3: am 65275e82: Merge "Fix HTTP cookie to do case mapping with Locale.US." into honeycomb

* commit '1c3170be4e2ec3b895027c848e6429062bb7c74d':
Fix HTTP cookie to do case mapping with Locale.US.
1c3170be4e2ec3b895027c848e6429062bb7c74d 14-Jan-2011 Jesse Wilson <jessewilson@google.com> am 2d6d9bc3: am 65275e82: Merge "Fix HTTP cookie to do case mapping with Locale.US." into honeycomb

* commit '2d6d9bc3752d52b93f55a6f7c9a52c7dd5cd7f0a':
Fix HTTP cookie to do case mapping with Locale.US.
f162edaa335461474b020027bb2e85eb3be2c179 14-Jan-2011 Jesse Wilson <jessewilson@google.com> Fix HTTP cookie to do case mapping with Locale.US.

While I'm here fix a MockWebServer bug I recently introduced
that broke cookie tests that needed to know port numbers before
responses were enqueued.

Change-Id: Idb2389ac5ed66656248c10aeb68209641acc0a68
http://b/3325637
ookiesTest.java
c08b5f81dbe5aba03208538570c5434a9dd0eb36 14-Jan-2011 Jesse Wilson <jessewilson@google.com> Fix test to agree with new Socket.toString() text.

Change-Id: Ia5471e3c0718b289e0477424e912e4e8ae55906a
ldSocketTest.java
d6cb085299ff68ba53d537705f84a497a8b8d28a 13-Jan-2011 Jesse Wilson <jessewilson@google.com> am 41390693: am 094ef677: Merge "Move tests from android.core.URLTest to URLConnectionTest." into honeycomb

* commit '41390693ceb598b4ccb47ec9d2f863c5409d2456':
Move tests from android.core.URLTest to URLConnectionTest.
b7f4d6c3968c372767b2510f38a3d506067aced6 13-Jan-2011 Jesse Wilson <jessewilson@google.com> Move tests from android.core.URLTest to URLConnectionTest.

This includes some changes to MockWebServer to make it stop
accepting connections as soon as its response queue is empty.

Change-Id: I5a6bcdf1c03d0c36b11552ae086d0dece0440f64
http://b/1158780
RLConnectionTest.java
fa9f91a486b81b19db13eab59e704179381de22f 12-Jan-2011 Jesse Wilson <jessewilson@google.com> Fix typo in testResponseCacheCallbackApis().

Embarassing. Test passes with the typo fixed!

Change-Id: Ic348f68c0e720163ca77b125415b01e840c7412d
RLConnectionTest.java
2c9f1e5b63c624793d01038a2b0c72e853c017df 09-Jan-2011 Elliott Hughes <enh@google.com> am 90a81872: am 3a9a00ad: Fix getifaddrs(3).

* commit '90a818723ba7efc7c7d6a35b8c2b1adfb2fdc955':
Fix getifaddrs(3).
3a9a00ad1f166a8e5ea810099b057522f9aecb48 08-Jan-2011 Elliott Hughes <enh@google.com> Fix getifaddrs(3).

Originally, we pulled out the IFA_ADDRESS messages and used them. That didn't
work with sholes' ppp interface, where we'd report the *destination* address
rather than the local address. We switched to the logical-sounding IFA_LOCAL
messages instead: for IPv4 you always get both IFA_ADDRESS and IFA_LOCAL, and
they're either the same, or you want IFA_LOCAL. It turns out that you don't
get IFA_LOCAL addresses for IPv6 unless they differ from the corresponding
IFA_ADDRESS. So what we have to do is use the IFA_ADDRESS but let IFA_LOCAL
override it, if it appears.

This code was getting way too large, so I've ripped the implementation out of
the header file and given it its own file. I've also switched to UniquePtr
now it exists, and removed a few unnecessary #includes of "LocalArray.h".

I've also added a unit test to help guard against breaking this again.

Bug: http://code.google.com/p/android/issues/detail?id=13784
Change-Id: I5a7d29b8e9bf652160eca043802363feb91421a2
etworkInterfaceTest.java
f14bee4dbf9f724a177a85a7b73f7b0bc6df1ec0 06-Jan-2011 Jesse Wilson <jessewilson@google.com> Return HTTP headers even if there is no HTTP response body.

Also add a test to demonstrate that we've bug 7787.
http://code.google.com/p/android/issues/detail?id=7787

Change-Id: I4e320835516c05ec9e305661b5bbb1e59b278183
RLConnectionTest.java
19b9b8115e2946ffbf68148d8755a76b37b082e5 17-Dec-2010 Jesse Wilson <jessewilson@google.com> Merge "Tests to cover Socket's surprising behavior on read after close"
ac41d7fe545831906171e3e86e1d18e201fd7739 17-Dec-2010 Jesse Wilson <jessewilson@google.com> Tests to cover Socket's surprising behavior on read after close

Change-Id: I9bd5d3cb718dc10ae0b419cdd46920d79e19419b
http://b/2612240
ocketTest.java
e942f46f10bb9384a1b186b3d7b74f9704c57090 17-Dec-2010 Jesse Wilson <jessewilson@google.com> Test that HttpURLConnection responds gracefully when the server closes a socket.

Change-Id: I5110d58d91e7c6f8f7553ad400f0bd841bcf07b6
http://b/2612240
RLConnectionTest.java
54c8a07db3c2d1670c2867ba864d351cb30fecfa 17-Dec-2010 Brian Carlstrom <bdc@google.com> resolved conflicts for merge of 5fc737eb to master

Change-Id: Ifc2a4fd44cef525709a3b9dc0a502b1a0690c6fd
2915378e253f08e47fe5a9bfd026cd1ca7c6c351 16-Dec-2010 Brian Carlstrom <bdc@google.com> HttpsURLConnection retry should not invoke X509TrustManager and HostnameVerifier more than once

Summary:

In 2.3, HttpsURLConnection was change to retry TLS connections as SSL
connections w/o compression to deal with servers that are TLS
intolerant. However, if the handshake proceeded to the point of
invoking the X509TrustManager, we should not retry. Similarly, if we
should not invoke the HostnameVerifier repeatedly, and need to wait
until the SSL handshake has completed.

Tested with (includes two new tests for this issue):
libcore/luni/src/test/java/libcore/javax/net/ssl/
libcore/luni/src/test/java/libcore/java/net/URLConnectionTest.java
libcore/luni/src/test/java/org/apache/harmony/luni/tests/internal/net/www/protocol/https/HttpsURLConnectionTest.java

Details:

HttpConnection.setupSecureSocket has been broken into two
pieces. setupSecureSocket now just does the SSL
handshaking. verifySecureSocketHostname now does the
verification. The old HttpConnection code was careful never to
assign its sslSocket field until verification was complete. A new
unverifiedSocket field is added to store the sslSocket before
verification is completed by verifySecureSocketHostname.

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java

HttpsEngine.makeConnection now skips TLS intolerant retry if the
reason for the makeSslConnection failure was a
CertificateException, since that implies that we failed during
certification validation after initial handshaking. We also
prevent retrying hostname verification by moving it out of
makeSslConnection and only doing it on new SSL connections,
tracking the changes to HttpConnection.setupSecureSocket mentioned
above. We also now skip the redundant call to setUpTransportIO in
makeSslConnection on reused SSLSockets.

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java

Instead of throwing away the underlying CertificateExceptions, set
them as the cause of the SSLExceptions. This is what the RI does
in the case of X509TrustManager failures and is now used by
HttpsEngine.makeConnection.

luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSessionImpl.java
luni/src/main/java/org/apache/harmony/xnet/provider/jsse/OpenSSLSocketImpl.java

Added new testConnectViaHttpsToUntrustedServer which makes sure
that connections are not retried on certificate verification
failure.

luni/src/test/java/libcore/java/net/URLConnectionTest.java

Added new test_SSLSocket_untrustedServer that verifies that an
SSLHandshakeException is thown containing a CertificateException
is thrown on certificate verification problems.

luni/src/test/java/libcore/javax/net/ssl/SSLSocketTest.java

Added second test CA and a new TestKeyStore.getClientCA2 test key
store that does not trust the primary test key stores. This is
useful for negative testing and is used in the above two new
tests.

support/src/test/java/libcore/java/security/TestKeyStore.java

Issue: http://code.google.com/p/android/issues/detail?id=13178
Bug: 3292412

Change-Id: I37136bb65f04d2bceaf2f32f542d6432c8b76ad4
RLConnectionTest.java
736e9fcc8bab781702e4a417b64981a8d1fa6ef3 15-Dec-2010 Jesse Wilson <jessewilson@google.com> am b84e9595: am c6dae581: Throw the expected exception after the response failed.

* commit 'b84e9595d2dff0d473be0699f3c8b06be2337712':
Throw the expected exception after the response failed.
c6dae581716b9362a5c7f166c80a7f2b46ed1124 06-Nov-2010 Jesse Wilson <jessewilson@google.com> Throw the expected exception after the response failed.

Change-Id: I4c2ed726d41d6b55e27a503467a412fa05242383
http://b/3172197
RLConnectionTest.java
990640f1775dc6f429a5f8b9fc6cab6b4220c03a 15-Dec-2010 Jesse Wilson <jessewilson@google.com> Move 41 tests to libcore, closer to the tested code.

Change-Id: I0ecaacd0e68b8319806555f71ddf347f01b17be9
http://b/3073226
ldAndroidDatagramTest.java
ldAndroidURITest.java
aab98fb377ef7c68d754fa3e02e1df3c5a9e75dc 08-Dec-2010 Jesse Wilson <jessewilson@google.com> Merge "Fix CookieTest to handle the HTTP request line ("GET / HTTP/1.1") map entry."
02ae9cdb41eba8faf9c9c78dae71b82592625f9f 08-Dec-2010 Jesse Wilson <jessewilson@google.com> Fix CookieTest to handle the HTTP request line ("GET / HTTP/1.1") map entry.

This map entry has a null key; the test wasn't expecting that.

Change-Id: I9029008a9a7b0e02f3995a7003b8e0c348d80581
ookiesTest.java
d8978911d3b75a3543f8c0e14d10325e0224bfd2 07-Dec-2010 Jesse Wilson <jessewilson@google.com> Merge "Fix OldResponseCacheTest. Null headers were causing our HttpClient to reject the cache entry."
3d92b84e9ae18282b3ae5b467e2b8ee516289189 07-Dec-2010 Jesse Wilson <jessewilson@google.com> Fix OldResponseCacheTest. Null headers were causing our HttpClient to reject the cache entry.

Change-Id: I49df200c069649a7c01ac0770426136fb07fe3a6
ldResponseCacheTest.java
4ce2ff6e19315b5ba071fc1739e071e585145dd4 07-Dec-2010 Jesse Wilson <jessewilson@google.com> Support IPv6 addresses in OldURLStreamHandlerTest.

Change-Id: Iafecaa7b71818747d6692dea166440d42963c4b5
ldURLStreamHandlerTest.java
8fd0225a5c3918fe0cd4680258388985c25533e5 06-Dec-2010 Jesse Wilson <jessewilson@google.com> Fix some of the most obvious bugs in URLStreamHandler's URL parsing.

Change-Id: I73ce6ccc169405e993d572ac3bf3af9ba39699c9
http://b/2753295
http://code.google.com/p/android/issues/detail?id=12724
RLTest.java
35eef71e8ce721c4199c525890ecc1a263054596 02-Dec-2010 Jesse Wilson <jessewilson@google.com> Fix two bugs with HTTPS + file uploads.

Firstly, we weren't echoing calls to setFixedLengthStreamingMode
and setChunkedStreamingMode from the HTTPS adapter down to the
real HTTP client.

Secondly, we were calling setTransportIO twice, and the second
call destroyed the buffer of our request body stream. That buffer
has only existed since change Id22a8449118a4b8dd13e71915700ac78803d2d9f,
(November 2, 2010) so the impact of that problem is limited.

Change-Id: Icb0eb2e0ca4e201a629bd74c3b98e852f6cc0fd3
http://code.google.com/p/android/issues/detail?id=12860
RLConnectionTest.java
72f1475a10d1f479cc8ce149fcc1783bc80ee4a7 02-Dec-2010 Jesse Wilson <jessewilson@google.com> Fix how OldDatagramSocketTest looks up 'localhost'.

Change-Id: If2a3a1e7d9f3ca386392357847ac1d655029f303
http://b/3246543
ldDatagramSocketTest.java
253851cdb2904082c205949da273c455d197c083 01-Dec-2010 Jesse Wilson <jessewilson@google.com> Do not merge: Fix a bug where we weren't pooling connections due to mismatched URLs.

Already committed to master as change 78504.

Change-Id: Ib883e92bb03b142f34449ef1314c57878dcc00f0

http://b/3169861
RLConnectionTest.java
6470a3002a17d866f067d68528217ee6272d47cb 30-Nov-2010 Elliott Hughes <enh@google.com> Regression test for URL(String) constructor bug.

Bug: http://code.google.com/p/android/issues/detail?id=12724
Change-Id: I354a7eda929d615fd81c100950505d726a4345ac
RLTest.java
dbc42ad94ce37b3178e14b50496914c267d6cea6 16-Nov-2010 Brian Carlstrom <bdc@google.com> HttpsURLConnection fixes to pass URLConnectionTest and HttpsURLConnectionTest

Add public getSecureSocket so that HttpsURLConnection can reset its sslSocket field on reused connections.

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpConnection.java

discardIntermediateResponse now maintain old values for
intermediateReponse, which is necessary when retrying the CONNECT
method with proxy authorization.

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/http/HttpURLConnectionImpl.java

Clear sslSocket before retrying makeSslConnection to ensure we reconnect.
makeSslConnection now resets sslSocket on resumed connection.
makeSslConnection now exits early on existing connection.

luni/src/main/java/org/apache/harmony/luni/internal/net/www/protocol/https/HttpsURLConnectionImpl.java

git cherry-pick -e 4df5be29bdffc09e7368c03423a0bef85fa26ac5
Bug: 3184701
Change-Id: Ida3c027f79e5e29968263ac761d4f4f79d063a27
RLConnectionTest.java
5bcbe1c84468a25fec1e5b4e1dd636f917c73422 16-Nov-2010 Brian Carlstrom <bdc@google.com> HttpsURLConnectionTest rewrite and URLConnectionTest updates

Rewrote HttpsURLConnectionTest to work with current SSLSocket
implementation which more strictly follows RI behavior.

Also made upates to URLConnectionTest related to HttpsURLConnection
- changed assertContent call connect() explictly to illustrate problem
with https proxy case also seen by HttpsURLConnectionTest
- Rewrote testConnectTimeouts to work reliably. Before if often
worked on WiFi but not on mobile networks where a "HTTP/1.1 501 Bad
Gateway" would be seen causing a FileNotFoundException.
- Changed testConnectViaHttpProxyToHttpsUsingHttpProxySystemProperty
to match expectation that https does not use the http.proxyHost
values. Added new testConnectViaHttpProxyToHttpsUsingProxyArgWithNoProxy
which should have the same behavior as the fixed
testConnectViaHttpProxyToHttpsUsingHttpProxySystemProperty

git cherry-pick -e f02c695ed03e708623d9365dec26d533356ef2d0

Bug: 3184701
Change-Id: Id25f619d2437db607deaf35aeb1d5e817514b92f
RLConnectionTest.java
5fc5dde4c719c1dfdac46b67d5d2e4884d07721e 16-Nov-2010 Elliott Hughes <enh@google.com> Improve ConcurrentCloseTest.

No more flaky use of 10.* addresses.

Bug: 3044772
Change-Id: I5ca8dc431b50950efdc818efe73eb9aba76ea67f
oncurrentCloseTest.java
RLConnectionTest.java
f02c695ed03e708623d9365dec26d533356ef2d0 16-Nov-2010 Brian Carlstrom <bdc@google.com> HttpsURLConnectionTest rewrite and URLConnectionTest updates

Rewrote HttpsURLConnectionTest to work with current SSLSocket
implementation which more strictly follows RI behavior.

Also made upates to URLConnectionTest related to HttpsURLConnection
- changed assertContent call connect() explictly to illustrate problem
with https proxy case also seen by HttpsURLConnectionTest
- Rewrote testConnectTimeouts to work reliably. Before if often
worked on WiFi but not on mobile networks where a "HTTP/1.1 501 Bad
Gateway" would be seen causing a FileNotFoundException.
- Changed testConnectViaHttpProxyToHttpsUsingHttpProxySystemProperty
to match expectation that https does not use the http.proxyHost
values. Added new testConnectViaHttpProxyToHttpsUsingProxyArgWithNoProxy
which should have the same behavior as the fixed
testConnectViaHttpProxyToHttpsUsingHttpProxySystemProperty

Change-Id: I397f55905524e2bbb587533f258ef0418ca8af80
RLConnectionTest.java
06e15e6c528fcb773bedb43e34b0577312570927 05-Nov-2010 Jesse Wilson <jessewilson@google.com> Fix a bug where we weren't pooling connections due to mismatched URLs.

Change-Id: I13bebc94189192c3f8d959e521989591d2fca3e2
RLConnectionTest.java
c1a675c80c69decadb736b245f0366f93a94a462 29-Oct-2010 Jesse Wilson <jessewilson@google.com> Remove the tree map in the HTTP headers.

This map is intended make looking up headers faster, but for real-world
sized datasets we spend more energy maintaining the map than we save from
using it.

I benchmarked the Android Market's HTTP connections' header use and it's
significantly faster to skip the map:

run us linear runtime
map+list 413.1 ==============================
list only 65.8 ====

Change-Id: I5b8fef6f999eb1bfe53eea2781f63cdd1002a273
RLConnectionTest.java
8ac847a52e72f0cefbb20a6850ae04468d433a9e 28-Oct-2010 Jesse Wilson <jessewilson@google.com> Fix broken interactions between HTTP response caches and redirects.

This fixes several specific problems:
- HTTP header map didn't contain the status line (under the null key)
- response code, message and version weren't set by caches
- caches didn't work with redirects

This change also makes some significant cleanup to the Headers class.
We might be able to simplify this further by dropping the map, should
that prove efficient enough.

Change-Id: Ib79ec17bef5978b3234f68102114eee7d4b7cda2
http://b/3139211
http://b/3139211
RLConnectionTest.java
2dcd7e784e98faf21190a6431aa1dbff7212eb80 27-Oct-2010 Jesse Wilson <jessewilson@google.com> Merge "Fix ResponseCache to support caching of HTTPS responses." into dalvik-dev
37dcf5581f177229ca6c8e7d0d640361640bfb00 27-Oct-2010 Jesse Wilson <jessewilson@google.com> Fix ResponseCache to support caching of HTTPS responses.

Previously it would fail with an internal error because of
inconsistencies because HttpURLConnectionImpl claimed to be
'connected' when it had a cache hit, and HttpsURLConnection
acted upon this by talking to its sockets.

Change-Id: I51f4215ceb9c5fd851223a501488306fa6d382b1
http://b/3043966
RLConnectionTest.java
2925824515c1758fcb60354a06320017b1ebc34c 27-Oct-2010 Jesse Wilson <jessewilson@google.com> Fix some flakiness in hostname tests.

This was failing on some networks where 'testhost' was a DNS-registered
host name.

Change-Id: I99a14f397d54048f0cf3772577836eb5fc0e48cc
ldURLStreamHandlerTest.java
b9066f1baa8e3a0f2b73b0feb8a0a1d56eb83345 22-Oct-2010 Jesse Wilson <jessewilson@google.com> Merge commit '0fde4f69' into manualmerge

Conflicts:
luni/src/test/java/org/apache/harmony/archive/tests/java/util/jar/JarFileTest.java
luni/src/test/java/org/apache/harmony/archive/tests/java/util/zip/ZipFileTest.java

Change-Id: I8f7233f1fff35a1bea6ac56057b453f458f27a1b
aec2ed4b266b75aaab59c23ca71e355a9336b074 21-Oct-2010 Jesse Wilson <jessewilson@google.com> Remove tests for SecurityManager.

Many of the changes are to org.apache.harmony.* tests that we've copied
from upstream. We'll remove these duplicated tests completely once we
have the upstream Harmony tests properly integrated into CTS.

Change-Id: Idd6cfbeba5345156b207b9433928ee37b662c395
http://b/3102252
ldResponseCacheTest.java
ldSocketTest.java
ldURLClassLoaderTest.java
ldURLTest.java
90224a5fd4a49b519039bd29d72c0a6a06a2752b 19-Oct-2010 Jesse Wilson <jessewilson@google.com> Merge "Rewrite ProxySelector and write a test to go with it." into dalvik-dev
3b0348d1081a4645aa38da97ee299fadc040c1b4 19-Oct-2010 Jesse Wilson <jessewilson@google.com> Rewrite ProxySelector and write a test to go with it.

http://b/3097518

Change-Id: Ic6b28ab21e00b6b55a01ae7927b87ac0d0375b44
roxySelectorTest.java
2d48139e65edd15e4ebecf234a1b2461a7ab66cd 15-Oct-2010 Jesse Wilson <jessewilson@google.com> am 4ad543f9: am d9523a4f: am 7fe9c8ad: Merge "Tests for HTTP bugs using HTTPS through a proxy." into gingerbread

Merge commit '4ad543f9f67feed3c4a759179abd06e365560bf3' into dalvik-dev

* commit '4ad543f9f67feed3c4a759179abd06e365560bf3':
Tests for HTTP bugs using HTTPS through a proxy.
984fcff696380abd6ea14e80030f9fd2d09dbad0 14-Oct-2010 Jesse Wilson <jessewilson@google.com> Tests for HTTP bugs using HTTPS through a proxy.

Change-Id: I01b470204d4da46016794ab7040d5751e7116958
http://b/3097277
http://b/3097518
RLConnectionTest.java
7942de86beb191925a3062813749759151a893b4 01-Oct-2010 Jesse Wilson <jessewilson@google.com> am 8f3d7240: am 082d39a2: am e8c1e814: Merge "Don\'t explode if flush() is called when an HTTP upload stream is closed." into gingerbread

Merge commit '8f3d7240bafb2753514b7bc84c95ef9657452c83' into dalvik-dev

* commit '8f3d7240bafb2753514b7bc84c95ef9657452c83':
Don't explode if flush() is called when an HTTP upload stream is closed.
f29ad8a60254345d1943d1b3836482395a7c916f 30-Sep-2010 Jesse Wilson <jessewilson@google.com> Don't explode if flush() is called when an HTTP upload stream is closed.

Streams like BufferedOutputStream always call flush() even if it is
a no-op. These flushes must be permitted for compatibility with apps
that don't call close() until after the response has been retrieved.

Change-Id: Ic5c86ab6050c6c4d166c44ae5b4fc7a1688e7e45
http://b/3038470
RLConnectionTest.java
2bf7f92e16c747c13a4e43ac9a2db846d6f3c7f0 29-Sep-2010 Jesse Wilson <jessewilson@google.com> am 1542176d: am 48100926: am d33c0e52: Merge "Fix a problem where URL.equals() was returning true when both hosts couldn\'t resolve." into gingerbread

Merge commit '1542176d768492a781a96db9c3b5a84a007e3f21' into dalvik-dev

* commit '1542176d768492a781a96db9c3b5a84a007e3f21':
Fix a problem where URL.equals() was returning true when both hosts couldn't resolve.
ec4829ae7df1df41103876985e98b578e84d7827 29-Sep-2010 Jesse Wilson <jessewilson@google.com> am a0ba7267: am 5ac2871d: am 1f8243e3: Remove java.net tests that are redundant with Harmony.

Merge commit 'a0ba7267d5528faad755a871b79983e0d2d6c681' into dalvik-dev

* commit 'a0ba7267d5528faad755a871b79983e0d2d6c681':
Remove java.net tests that are redundant with Harmony.
67db542e53c47a28e3f96beb7c9e46330483dc40 29-Sep-2010 Jesse Wilson <jessewilson@google.com> Fix a problem where URL.equals() was returning true when both hosts couldn't resolve.

See http://b/3045007

Change-Id: I83f2a0d8888dd30aaf6099049ce8008487d4337d
ldURLTest.java
1f8243e3d2b5a3f8e0398c304d1dea0395cbc368 28-Sep-2010 Jesse Wilson <jessewilson@google.com> Remove java.net tests that are redundant with Harmony.

Change-Id: I01d6b3633a6de8a075982975d4cbf6c08e757490
ldAuthenticatorRequestorTypeTest.java
ldAuthenticatorTest.java
ldCookieHandlerTest.java
ldDatagramPacketTest.java
ldDatagramSocketImplFactoryTest.java
ldFileNameMapTest.java
ldHttpRetryExceptionTest.java
ldJarURLConnectionTest.java
ldNetPermissionTest.java
ldPasswordAuthenticationTest.java
ldProxyTest.java
ldServerSocketTest.java
ldSocketImplFactoryTest.java
ldSocketPermissionTest.java
ldSocketTest.java
ldSocketTestCase.java
ldURITest.java
ldURLDecoderTest.java
ldURLEncoderTest.java
ldURLStreamHandlerTest.java
RLConnectionTest.java
346a1f94c0726c6aa249dc1b962d4596f57ce557 27-Sep-2010 Elliott Hughes <enh@google.com> am a3160c78: am 793d8b21: am 3c6ca778: Don\'t wrap select(2) in TEMP_FAILURE_RETRY.

Merge commit 'a3160c78b635408fc9979e2984a377a3cc5aac04' into dalvik-dev

* commit 'a3160c78b635408fc9979e2984a377a3cc5aac04':
Don't wrap select(2) in TEMP_FAILURE_RETRY.
3c6ca77845ce5f0e80c4dc49617601918023c1ed 27-Sep-2010 Elliott Hughes <enh@google.com> Don't wrap select(2) in TEMP_FAILURE_RETRY.

Luckily, since the caller has to cope with us saying "we're not connected yet,
try again", we can just go that route.

I've also added another plausible possible exception to one of the tests, seen
once when testing on a host dalvikvm.

Bug: 3022824
Change-Id: Ia155f86f9f7b9b0a54e58c55f668faaebcbda55e
oncurrentCloseTest.java
1344f809742f6ff1398159e1f7a0741401bd9485 25-Sep-2010 Jesse Wilson <jessewilson@google.com> am 42e02ace: resolved conflicts for merge of 0c4b3205 to master

Merge commit '42e02ace8881e1d4e06de76e301dcb5dbf046ab4' into dalvik-dev

* commit '42e02ace8881e1d4e06de76e301dcb5dbf046ab4':
Rely on the test runner to ensure a pristine VM.
a884f455e2ad843819c36d2607790450d47475dd 25-Sep-2010 Jesse Wilson <jessewilson@google.com> Merge "Rely on the test runner to ensure a pristine VM." into gingerbread
0878d5af2d85f870a09b5b0aca86748c38ccf389 25-Sep-2010 Jesse Wilson <jessewilson@google.com> Fix OldResponseCache.test_get() which was broken by moving the test.

Change-Id: I7edc4348cae3181ead252c0a3f77015451d47826
ldResponseCacheTest.java
6e65088f21ac5bda5d25fade13ee360c5cba3457 25-Sep-2010 Jesse Wilson <jessewilson@google.com> Rely on the test runner to ensure a pristine VM.

Change-Id: I6f5bfad6f861eb7b398ed7d86747d66cea4f2343
http://b/issue?id=2660429
ldURLTest.java
00feece22909b7dc79fc96d666d157390b93858e 24-Sep-2010 Jesse Wilson <jessewilson@google.com> Strip usage of the term 'localhost' from URLConnectionTest.

Change-Id: I8ea7923c3ea72728c7df64c13bdd6f94b91be121
http://b/3032912
RLConnectionTest.java
ef66494dce45a0b7ec22ec3fb20c60096517a4e3 22-Sep-2010 Jesse Wilson <jessewilson@google.com> Fix problem where single-byte reads were unsigned.

Change-Id: Ib0bc273698b71d13a90a03a8c60498ad7de5ad9d
http://b/3023872
RLConnectionTest.java
d4bddd7d1fb7b1b7f0836648228235c6e4b56a18 16-Sep-2010 Jesse Wilson <jessewilson@google.com> Fix two HTTP issues that came up when writing HttpURLConnection docs.

We're now more careful about which headers are sent to HTTP proxies.
And getContentEncoding() is better documented.

Change-Id: I04241f99c2f32c25ba005fbd6ff9ef7236c3c9d3
RLConnectionTest.java
8116f7e97e00d223e7fbe5c950c9a5e3277de124 17-Sep-2010 Jesse Wilson <jessewilson@google.com> Don't leave the Content-Encoding header around after transparent gzip.

Otherwise clients may be tempted to double-decompress.
http://b/issue?id=3009828

Change-Id: I4832da1c2aff9bad8d452ffc4a0f98ee27d44f49
RLConnectionTest.java
7e29fa5a86c6d28d97e28a18184d3584ce83e61a 08-Sep-2010 Jesse Wilson <jessewilson@google.com> Merge "Cope with HTTP responses where the response code and headers disagree." into gingerbread
65d890eb22aeba9b009ee642ffd4fff48a6f98ae 08-Sep-2010 Jesse Wilson <jessewilson@google.com> Cope with HTTP responses where the response code and headers disagree.

See http://b/issue?id=2981779

Change-Id: I0e4ed8f0cc606aa419704ba2eb5cd9938b5ff320
RLConnectionTest.java
c390acc2461cce9edb3209caca28d95ed6aabd90 07-Sep-2010 Elliott Hughes <enh@google.com> Don't throw when calling Socket.close on a closed socket.

Bug: 2980559
Change-Id: I168573c16581a3a94b96f0ccdb458bfee76f11e0
ocketTest.java
b7155fd57239e986bbaba254a91aeb9600d60305 03-Sep-2010 Jesse Wilson <jessewilson@google.com> Fixing a broken pipe with HttpsURLConnection connection reuse.

We had a bug where we were peeking a byte from the raw socket
stream rather than the encrypted stream when we were attempting
to reuse an HTTPS connection. The raw stream field shouldn't
have been initialized, but setupTransportIO() did it while the
connection was being established.

This fixes setupTransportIO() to not initialize the fields
and isStale() to use the SSL fields if they exist.

See http://code.google.com/p/android/issues/detail?id=8625

Change-Id: Idd5b6f20e098adf436997829940707548896bedb
RLConnectionTest.java
50ae32218918eae80298bd1ab8e4f588bbbabdb2 01-Sep-2010 Jesse Wilson <jessewilson@google.com> Configure HttpURLConnection to prefer gzipped content by default.

This is not what the RI does. But the bandwidth savings is substantial,
and we can offer it almost for free.

See http://code.google.com/p/android/issues/detail?id=9390

Change-Id: I43c3fae8938f33809f2526d2d0e1cc5e08ae1202
RLConnectionTest.java
f418bf447fd007cd2ec2d45b4b0399a11904e9b4 30-Aug-2010 Jesse Wilson <jessewilson@google.com> Support "Connection: close" from both request and response.

This is a rewrite of fix for the same problem in AOSP master:
https://review.source.android.com/16757

This expands on that fix by supporting "Connection: close" on
redirects by adding test coverage.

Change-Id: Ia0daa9d83cf9f557b4e9a99b2c51345c98c6db14
RLConnectionTest.java
125f068f0a6cd739beac97821c9421cf8317cc87 20-Aug-2010 Jesse Wilson <jessewilson@google.com> Fix a bug when user sets "Content-Encoding: chunked" manually.

We used to try to build a -1-sized ByteArrayOutputStream, which
failed miserably with an exception.

Change-Id: Ia6fa72c639a14c03f03b6f73083ce37ffab8b4e5
RLConnectionTest.java
4557728efb66c455a52b7669a8eefef7a9e54854 11-Aug-2010 Jesse Wilson <jessewilson@google.com> Moving tests to be under the libcore.* package.

This is indended to make it easier to run on VMs that restrict the packages
from which application classes can be loaded. For example, on the RI you need
to use the bootclasspath to load these tests.

Change-Id: I52193f35c5fcca18b5a3e1d280505b1e29b388af
oncurrentCloseTest.java
ookiesTest.java
DNTest.java
ldDatagramSocketTest.java
ldResponseCacheTest.java
ldURLClassLoaderTest.java
ldURLStreamHandlerFactoryTest.java
ldURLTest.java
ldUnixSocketTest.java
ocketTest.java
RLConnectionTest.java
riTest.java