Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add socket policy to disconnect mid-response. #1716

Merged
merged 1 commit into from
Jun 21, 2015
Merged

Conversation

JakeWharton
Copy link
Collaborator

No description provided.

assertEquals(2, connection.getHeaderFieldLong("Content-Length", -1));
InputStream in = connection.getInputStream();
assertEquals('a', in.read());
assertEquals(-1, in.read());
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yikes! I would have expected an exception!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... yeah this is a pretty nasty bug, isn't it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(ProtocolException: promised 2 bytes but was 1)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh... this is a bug in Oracle's HttpURLConnection, not our own. Phew.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've improved our own tests here:
#1718

swankjesse added a commit that referenced this pull request Jun 21, 2015
Add socket policy to disconnect mid-response.
@swankjesse swankjesse merged commit 77fb83f into master Jun 21, 2015
@JakeWharton JakeWharton deleted the jw/kill-halfway branch December 14, 2015 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants