diff --git a/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java b/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java index 6b4ac343b..cabe82672 100644 --- a/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java +++ b/okhttp/src/main/java/com/squareup/okhttp/internal/Platform.java @@ -201,6 +201,9 @@ public class Platform { try { NetworkInterface networkInterface = NetworkInterface.getByInetAddress( socket.getLocalAddress()); + if (networkInterface == null) { + return super.getMtu(socket); // There's no longer an interface with this local address. + } return (Integer) getMtu.invoke(networkInterface); } catch (IllegalAccessException e) { throw new AssertionError(e);