code: public synchronized void connected(ISOBUSSocket engSocket,
              ISOBUSSocket impSocket, ISOBUSSocket bufEngSocket,
              ISOBUSSocket bufImpSocket, ISOBlueDevice device) {
          // Cancel the thread that completed the connection
          if (mConnectThread != null) {
              mConnectThread.cancel();
              mConnectThread = null;
          }
  
          // Cancel any thread currently running a connection
          if (mEngConnectedThread != null) {
              mEngConnectedThread.cancel();
              mEngConnectedThread = null;
          }
          if (mImpConnectedThread != null) {
              mImpConnectedThread.cancel();
              mImpConnectedThread = null;
          }
  
          // Start the thread to manage the connection and perform transmissions
          mEngConnectedThread = new ConnectedThread(engSocket,
                  ISOBlueDemo.MESSAGE_ARG1_NEW);
          mEngConnectedThread.start();
          mImpConnectedThread = new ConnectedThread(impSocket,
                  ISOBlueDemo.MESSAGE_ARG1_NEW);
          mImpConnectedThread.start();
          if (mPast) {
              mBufEngConnectedThread = new ConnectedThread(bufEngSocket,
                      ISOBlueDemo.MESSAGE_ARG1_BUF);
              mBufEngConnectedThread.start();
              mBufImpConnectedThread = new ConnectedThread(bufImpSocket,
                      ISOBlueDemo.MESSAGE_ARG1_BUF);
              mBufImpConnectedThread.start();
          }
  
          // Send the name of the connected device back to the UI Activity
          Message msg = mHandler.obtainMessage(ISOBlueDemo.MESSAGE_DEVICE_NAME);
          Bundle bundle = new Bundle();
          bundle.putString(ISOBlueDemo.DEVICE_NAME, device.getDevice().getName());
          msg.setData(bundle);
          mHandler.sendMessage(msg);
  
          setState(STATE_CONNECTED);
      }
docs: Start the ConnectedThread to begin managing a Bluetooth connection
  
  @param engSocket
  @param impSocket
  @param bufEngSocket
  @param bufImpSocket
  @param device
  The BluetoothDevice that has been connected