Skip to content

Commit

Permalink
Merge pull request square#1326 from nfuller/FixSocketCloseOnAndroid
Browse files Browse the repository at this point in the history
Fix for MockWebServer on Android
  • Loading branch information
JakeWharton committed Jan 15, 2015
2 parents c780302 + 0b69d29 commit 84d87a7
Showing 1 changed file with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,9 @@ private boolean processOneRequest(Socket socket, BufferedSource source, Buffered
if (response.getSocketPolicy() == SocketPolicy.DISCONNECT_AT_END) {
source.close();
sink.close();
// Workaround for bug on Android: closing the input/output streams should close an
// SSLSocket but does not. https://code.google.com/p/android/issues/detail?id=97564
socket.close();
} else if (response.getSocketPolicy() == SocketPolicy.SHUTDOWN_INPUT_AT_END) {
socket.shutdownInput();
} else if (response.getSocketPolicy() == SocketPolicy.SHUTDOWN_OUTPUT_AT_END) {
Expand Down

0 comments on commit 84d87a7

Please sign in to comment.