code: public synchronized void connect(BluetoothDevice device) {
          // Cancel any thread attempting to make a connection
          if (mState == BluetoothService.STATE_CONNECTING) {
              if (mConnectThread != null) {mConnectThread.cancel(); mConnectThread = null;}
          }
  
          // Cancel any thread currently running a connection
          if (mConnectedThread != null) {mConnectedThread.cancel(); mConnectedThread = null;}
  
          // Start the thread to tryConnect with the given device
          mConnectThread = new ConnectThread(device);
          mConnectThread.start();
          setState(BluetoothService.STATE_CONNECTING);
      }
docs: secure : Socket Security type - Secure (true) , Insecure (false)