title: java.io.IOException: read failed, socket might closed or timeout, read ret: -1 on Android 5.0.1 Lollipop version
body: <p>I am making Bluetooth socket connection to Bluetooth device and want to read bytes from the device.</p>
  
  <p>I have established connection correctly  :</p>
  
  <pre><code> try {
           Method m = mmDevice.getClass().getMethod("createRfcommSocket", new Class[] { int.class });
            temp = (BluetoothSocket) m.invoke(mmDevice, 1);
   } catch (Exception e) {
   }
  </code></pre>
  
  <p>I am reading bytes correctly from Bluetooth device.</p>
  
  <p>I am getting the exception : </p>
  
  <blockquote>
    <p>java.io.IOException: read failed, socket might closed or timeout, read
    ret: -1</p>
  </blockquote>
  
  <p>Due to this, the connection is broken and the communication is also over between my device and Bluetooth device.</p>
  
  <p>This problem is coming on Android 5.0.1 Lollipop especially</p>
  
  <p>Can anyone have workaround ?</p>