rpc/bt: close bluetooth socket when fails

  Close bluetooth socket when it fails on any operation
  to release any system resources.

Change-Id: I4db0311df769ca311765a68ad570c2ba12970427
diff --git a/android-lib/src/main/java/io/v/android/impl/google/rpc/protocols/bt/Bluetooth.java b/android-lib/src/main/java/io/v/android/impl/google/rpc/protocols/bt/Bluetooth.java
index 0bbb048..8b2af7b 100644
--- a/android-lib/src/main/java/io/v/android/impl/google/rpc/protocols/bt/Bluetooth.java
+++ b/android-lib/src/main/java/io/v/android/impl/google/rpc/protocols/bt/Bluetooth.java
@@ -105,6 +105,7 @@
                             try {
                                 socket.connect();
                             } catch (IOException e) {
+                                socket.close();
                                 callback.onFailure(
                                         new VException("Couldn't connect: " + e.getMessage()));
                             } finally {
@@ -247,6 +248,10 @@
                                 callback.onSuccess(
                                         new Stream(executor, socket, localAddress, remoteAddress));
                             } catch (IOException e) {
+                                try {
+                                    serverSocket.close();
+                                } catch (IOException ioe) {
+                                }
                                 callback.onFailure(new VException(e.getMessage()));
                             }
                         }
@@ -290,6 +295,10 @@
                                 callback.onSuccess(
                                         num == buf.length ? buf : Arrays.copyOf(buf, num));
                             } catch (IOException e) {
+                                try {
+                                    socket.close();
+                                } catch (IOException ioe) {
+                                }
                                 callback.onFailure(new VException(e.getMessage()));
                             }
                         }
@@ -305,6 +314,10 @@
                                 socket.getOutputStream().write(data);
                                 callback.onSuccess(null);
                             } catch (IOException e) {
+                                try {
+                                    socket.close();
+                                } catch (IOException ioe) {
+                                }
                                 callback.onFailure(new VException(e.getMessage()));
                             }
                         }