title: accept() and connect() methods in bluetooth socket
body: <p>I am getting bluetooth socket connection problem and so tried various alternatives to connect.</p>
  
  <p>It is like if first fails then second and if second also fails then third and so the main UI blocks during the process.</p>
  
  <p>The exceptions are like -</p>
  
  <p><code>"Service discovery failed"</code> OR <code>"Host is down"</code></p>
  
  <p>My all three alternatives -</p>
  
  <p><strong>1)</strong> <strong>Connect with a connect() function</strong></p>
  
  <pre><code>   m = bdDevice.getClass().getMethod("createRfcommSocket", new Class[] {int.class});
  
     socket = (BluetoothSocket) m.invoke(bdDevice, Integer.valueOf(i));
  
     mBluetoothAdapter.cancelDiscovery();
  
     socket.connect();
  </code></pre>
  
  <p><strong>2) Connect with a accept() function</strong></p>
  
  <pre><code>   m = bdDevice.getClass().getMethod ("listenUsingRfcommOn", new Class [] {int.class}); 
  
     BluetoothServerSocket returnValue = 
     (BluetoothServerSocket) m.invoke(bdDevice, new Object [] {29});
  
     socket = returnValue.accept();   
  </code></pre>
  
  <p><strong>3) Connect with a well know SPP UUID</strong></p>
  
  <pre><code> private final UUID my_UUID = UUID.fromString("00001101-0000-1000-8000-00805F9B34FB");
  
   socket = bdDevice.createInsecureRfcommSocketToServiceRecord(my_UUID);
  
   mBluetoothAdapter.cancelDiscovery();
  
   socket.connect();
  </code></pre>
  
  <p>The second alternative is recently added and so I am not sure that how is it different from first and third one. All will block the UI until connect, all can through IOException.</p>