Fix NPE in Connection#close when socket == null.

This is a partial cherry-pick of the upstream commit
c26f9af0489869a9e1873ed5010c65f8464cff26.

bug: 16907112

(cherry picked from commit c2bb00c4a14c9929d9126c39aeda4cb24576ef3e)

Change-Id: I80e451ec1daf55b5ae5c3a76290cf48d5e3de559
diff --git a/okhttp/src/main/java/com/squareup/okhttp/Connection.java b/okhttp/src/main/java/com/squareup/okhttp/Connection.java
index 39ca4d0..94527af 100644
--- a/okhttp/src/main/java/com/squareup/okhttp/Connection.java
+++ b/okhttp/src/main/java/com/squareup/okhttp/Connection.java
@@ -225,7 +225,7 @@
   }
 
   @Override public void close() throws IOException {
-    socket.close();
+    if (socket != null) socket.close();
   }
 
   /** Returns the route used by this connection. */