public void testConnectInput(){
  int iterations=BluetoothTestRunner.sConnectInputIterations;
  if (iterations == 0) {
    return;
  }
  BluetoothAdapter adapter=BluetoothAdapter.getDefaultAdapter();
  BluetoothDevice device=adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress);
  mTestUtils.disable(adapter);
  mTestUtils.enable(adapter);
  mTestUtils.unpair(adapter,device);
  mTestUtils.pair(adapter,device,BluetoothTestRunner.sDevicePairPasskey,BluetoothTestRunner.sDevicePairPin);
  mTestUtils.disconnectProfile(adapter,device,BluetoothProfile.INPUT_DEVICE,null);
  for (int i=0; i < iterations; i++) {
    mTestUtils.writeOutput("connectInput iteration " + (i + 1) + " of "+ iterations);
    mTestUtils.connectProfile(adapter,device,BluetoothProfile.INPUT_DEVICE,String.format("connectInput(device=%s)",device));
    mTestUtils.disconnectProfile(adapter,device,BluetoothProfile.INPUT_DEVICE,String.format("disconnectInput(device=%s)",device));
  }
  mTestUtils.unpair(adapter,device);
  mTestUtils.disable(adapter);
}

public void testConnectInput ( ) { int iterations = BluetoothTestRunner . sConnectInputIterations ; if ( iterations == 0 ) { return ; } BluetoothAdapter adapter = BluetoothAdapter . getDefaultAdapter ( ) ; BluetoothDevice device = adapter . getRemoteDevice ( BluetoothTestRunner . sDeviceAddress ) ; mTestUtils . disable ( adapter ) ; mTestUtils . enable ( adapter ) ; mTestUtils . unpair ( adapter , device ) ; mTestUtils . pair ( adapter , device , BluetoothTestRunner . sDevicePairPasskey , BluetoothTestRunner . sDevicePairPin ) ; mTestUtils . disconnectProfile ( adapter , device , BluetoothProfile . INPUT_DEVICE , null ) ; for ( int i = 0 ; i < iterations ; i ++ ) { mTestUtils . writeOutput ( "connectInput iteration " + ( i + 1 ) + " of " + iterations ) ; mTestUtils . connectProfile ( adapter , device , BluetoothProfile . INPUT_DEVICE , String . format ( "connectInput(device=%s)" , device ) ) ; mTestUtils . disconnectProfile ( adapter , device , BluetoothProfile . INPUT_DEVICE , String . format ( "disconnectInput(device=%s)" , device ) ) ; } mTestUtils . unpair ( adapter , device ) ; mTestUtils . disable ( adapter ) ; }
stress test for connecting and disconnecting with a hid device . < p > in this test , the local device plays the role of a hid host , and initiates connections and disconnections with a hid device .
