title: Android Bluetooth Socket Connect Hangs
body: <p>I am having an issue where when I call sock.connect() it just hangs indefinitely.  There is no exception and no timeout.</p>
  
  <pre><code>try
      {
          Method m = dev.getClass().getMethod("createRfcommSocket", new     Class[] {int.class});          
          sock = (BluetoothSocket) m.invoke(dev, 1); 
          sock.connect();
          Thread.sleep(100);
          in = sock.getInputStream();
          out = sock.getOutputStream();
      }
      catch(ConnectTimeoutException ex)
      {
          return false;
      }
      catch(IOException ex)
      {
          return false;
      }
      catch(Exception ex)
      {
          return false;
      }
  </code></pre>
  
  <p>The reason is that another app is using the bluetooth device already.  I am trying to make my connection fail and at least throw an exception or something to let me know the device is already in use by another app.</p>
  
  <p>Any other suggestions to approaching this?</p>
  
  <p>Thanks.</p>