114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe/* 214db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * Copyright (C) 2010 The Android Open Source Project 314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * 414db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * Licensed under the Apache License, Version 2.0 (the "License"); 514db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * you may not use this file except in compliance with the License. 614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * You may obtain a copy of the License at 714db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * 814db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * http://www.apache.org/licenses/LICENSE-2.0 914db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * 1014db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * Unless required by applicable law or agreed to in writing, software 1114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * distributed under the License is distributed on an "AS IS" BASIS, 1214db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * See the License for the specific language governing permissions and 1414db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe * limitations under the License. 1514db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe */ 1614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 1714db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowepackage android.bluetooth; 1814db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 1914db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Roweimport android.content.Context; 2014db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Roweimport android.test.InstrumentationTestCase; 2114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 227e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe/** 237e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test suite for Bluetooth related functions. 247e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * 257e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Includes tests for enabling/disabling bluetooth, enabling/disabling discoverable mode, 267e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * starting/stopping scans, connecting/disconnecting to HFP, A2DP, HID, PAN profiles, and verifying 277e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * that remote connections/disconnections occur for the PAN profile. 287e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 297e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * This test suite uses {@link android.bluetooth.BluetoothTestRunner} to for parameters such as the 307e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * number of iterations and the addresses of remote Bluetooth devices. 317e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 3214db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowepublic class BluetoothStressTest extends InstrumentationTestCase { 33e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe private static final String TAG = "BluetoothStressTest"; 34e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe private static final String OUTPUT_FILE = "BluetoothStressTestOutput.txt"; 35fca8e9d919443449807f87203609e53a64368f6bEric Rowe /** The amount of time to sleep between issuing start/stop SCO in ms. */ 36fca8e9d919443449807f87203609e53a64368f6bEric Rowe private static final long SCO_SLEEP_TIME = 2 * 1000; 3714db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 38185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe private BluetoothTestUtils mTestUtils; 3914db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 4014db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe @Override 4114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe protected void setUp() throws Exception { 4214db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe super.setUp(); 4314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 44185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe Context context = getInstrumentation().getTargetContext(); 45185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils = new BluetoothTestUtils(context, TAG, OUTPUT_FILE); 4614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 4714db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 4814db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe @Override 4914db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe protected void tearDown() throws Exception { 5014db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe super.tearDown(); 5114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 52185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.close(); 5314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 5414db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 557e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 567e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for enabling and disabling Bluetooth. 577e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 58e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe public void testEnable() { 59e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe int iterations = BluetoothTestRunner.sEnableIterations; 60826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe if (iterations == 0) { 61826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe return; 62826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 63826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 6414db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 652b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 6614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 67e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe for (int i = 0; i < iterations; i++) { 68185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.writeOutput("enable iteration " + (i + 1) + " of " + iterations); 69185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.enable(adapter); 70185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.disable(adapter); 7114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 7214db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 7314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 747e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 757e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for putting the device in and taking the device out of discoverable mode. 767e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 7714db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe public void testDiscoverable() { 78e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe int iterations = BluetoothTestRunner.sDiscoverableIterations; 79826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe if (iterations == 0) { 80826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe return; 81826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 82826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 8314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 842b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 85185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.enable(adapter); 862b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.undiscoverable(adapter); 8714db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 88e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe for (int i = 0; i < iterations; i++) { 89185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.writeOutput("discoverable iteration " + (i + 1) + " of " + iterations); 90185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.discoverable(adapter); 91185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.undiscoverable(adapter); 9214db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 9314db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 94185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.disable(adapter); 9514db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 9614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 977e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 987e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for starting and stopping Bluetooth scans. 997e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 10014db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe public void testScan() { 101e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe int iterations = BluetoothTestRunner.sScanIterations; 102826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe if (iterations == 0) { 103826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe return; 104826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 105826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 10614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 1072b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 108185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.enable(adapter); 1092b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.stopScan(adapter); 11014db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 111e1d666b632608a2f708cb3df06c796e16d5d1717Eric Rowe for (int i = 0; i < iterations; i++) { 112185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.writeOutput("scan iteration " + (i + 1) + " of " + iterations); 113185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.startScan(adapter); 114185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.stopScan(adapter); 11514db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 11614db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe 117185a0b04c611a287cbd866d27b0ceff77f12d97bEric Rowe mTestUtils.disable(adapter); 11814db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe } 119826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 1207e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 1217e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for enabling and disabling the PAN NAP profile. 1227e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 1237e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe public void testEnablePan() { 1247e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe int iterations = BluetoothTestRunner.sEnablePanIterations; 125b525f089cf0f580ccb26e80bbb0db1376ba554ccBrett Chabot if (iterations == 0) { 126b525f089cf0f580ccb26e80bbb0db1376ba554ccBrett Chabot return; 127b525f089cf0f580ccb26e80bbb0db1376ba554ccBrett Chabot } 1287e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 1292b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 1307e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.enable(adapter); 1312b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disablePan(adapter); 1327e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 1337e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe for (int i = 0; i < iterations; i++) { 1347e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.writeOutput("testEnablePan iteration " + (i + 1) + " of " 1357e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe + iterations); 1367e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.enablePan(adapter); 1377e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disablePan(adapter); 1387e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 1397e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 1407e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disable(adapter); 1417e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 1427e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 1437e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 1447e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for pairing and unpairing with a remote device. 1457e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 1467e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device initiates pairing with a remote device, and then unpairs with 1477e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * the device after the pairing has successfully completed. 1487e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 149826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe public void testPair() { 150826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe int iterations = BluetoothTestRunner.sPairIterations; 151826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe if (iterations == 0) { 152826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe return; 153826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 154826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 155826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 1562b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 1572b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 158826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.enable(adapter); 1592b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 160826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 161826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe for (int i = 0; i < iterations; i++) { 162826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.writeOutput("pair iteration " + (i + 1) + " of " + iterations); 1632b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.pair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 1642b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 16523c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe mTestUtils.unpair(adapter, device); 16623c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe } 16723c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe mTestUtils.disable(adapter); 16823c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe } 16923c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe 1707e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 1717e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for accepting a pairing request and unpairing with a remote device. 1727e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 1737e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device waits for a pairing request from a remote device. It accepts 1747e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * the request and then unpairs after the paring has successfully completed. 1757e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 17623c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe public void testAcceptPair() { 17723c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe int iterations = BluetoothTestRunner.sPairIterations; 178b525f089cf0f580ccb26e80bbb0db1376ba554ccBrett Chabot if (iterations == 0) { 179b525f089cf0f580ccb26e80bbb0db1376ba554ccBrett Chabot return; 180b525f089cf0f580ccb26e80bbb0db1376ba554ccBrett Chabot } 18123c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 1822b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 1832b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 18423c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe mTestUtils.enable(adapter); 1852b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 18623c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe 18723c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe for (int i = 0; i < iterations; i++) { 18823c067692be74c4fcd50cea48f9d469ba5288213Eric Rowe mTestUtils.writeOutput("acceptPair iteration " + (i + 1) + " of " + iterations); 1892b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.acceptPair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 1902b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 191826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.unpair(adapter, device); 192826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 193826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.disable(adapter); 194826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 195826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 1967e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 1977e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for connecting and disconnecting with an A2DP source. 1987e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 1997e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device plays the role of an A2DP sink, and initiates connections and 2007e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * disconnections with an A2DP source. 2017e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 202826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe public void testConnectA2dp() { 203826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe int iterations = BluetoothTestRunner.sConnectA2dpIterations; 204826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe if (iterations == 0) { 205826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe return; 206826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 207826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 208826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 2092b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 2102b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 211826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.enable(adapter); 2122b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 2132b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.pair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 2142b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 2152b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.A2DP, null); 216826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 217826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe for (int i = 0; i < iterations; i++) { 218826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.writeOutput("connectA2dp iteration " + (i + 1) + " of " + iterations); 2192b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.connectProfile(adapter, device, BluetoothProfile.A2DP, 2202b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe String.format("connectA2dp(device=%s)", device)); 2212b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.A2DP, 2222b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe String.format("disconnectA2dp(device=%s)", device)); 223826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 224826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 2257e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.unpair(adapter, device); 226826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.disable(adapter); 227826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 228826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 2297e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 2307e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for connecting and disconnecting the HFP with a hands free device. 2317e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 2327e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device plays the role of an HFP audio gateway, and initiates 2337e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * connections and disconnections with a hands free device. 2347e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 235826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe public void testConnectHeadset() { 236826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe int iterations = BluetoothTestRunner.sConnectHeadsetIterations; 237826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe if (iterations == 0) { 238826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe return; 239826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 240826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 241826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 2422b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 2432b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 244826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.enable(adapter); 2452b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 2462b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.pair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 2472b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 2482b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null); 249826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 250826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe for (int i = 0; i < iterations; i++) { 251826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.writeOutput("connectHeadset iteration " + (i + 1) + " of " + iterations); 2522b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.connectProfile(adapter, device, BluetoothProfile.HEADSET, 2532b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe String.format("connectHeadset(device=%s)", device)); 2542b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, 2552b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe String.format("disconnectHeadset(device=%s)", device)); 256826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 257826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe 2587e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.unpair(adapter, device); 2597e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disable(adapter); 2607e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 2617e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 2627e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 2637e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for connecting and disconnecting with a HID device. 2647e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 2657e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device plays the role of a HID host, and initiates connections and 2667e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * disconnections with a HID device. 2677e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 2687e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe public void testConnectInput() { 2697e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe int iterations = BluetoothTestRunner.sConnectInputIterations; 2707e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe if (iterations == 0) { 2717e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe return; 2727e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 2737e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 2747e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 2752b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 2762b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 2777e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.enable(adapter); 2782b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 2792b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.pair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 2802b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 2812b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.INPUT_DEVICE, null); 2827e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 2837e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe for (int i = 0; i < iterations; i++) { 2847e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.writeOutput("connectInput iteration " + (i + 1) + " of " + iterations); 2852b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.connectProfile(adapter, device, BluetoothProfile.INPUT_DEVICE, 2862b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe String.format("connectInput(device=%s)", device)); 2872b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.INPUT_DEVICE, 2882b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe String.format("disconnectInput(device=%s)", device)); 2897e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 2907e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 2917e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.unpair(adapter, device); 2927e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disable(adapter); 2937e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 2947e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 2957e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 2967e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for connecting and disconnecting with a PAN NAP. 2977e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 2987e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device plays the role of a PANU, and initiates connections and 2997e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * disconnections with a NAP. 3007e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 3017e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe public void testConnectPan() { 3027e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe int iterations = BluetoothTestRunner.sConnectPanIterations; 3037e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe if (iterations == 0) { 3047e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe return; 3057e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 3067e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3077e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 3082b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 3092b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 3107e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.enable(adapter); 3112b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 3122b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.pair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 3132b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 3147e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3157e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe for (int i = 0; i < iterations; i++) { 3167e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.writeOutput("connectPan iteration " + (i + 1) + " of " + iterations); 3177e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.connectPan(adapter, device); 3187e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disconnectPan(adapter, device); 3197e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 3207e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3217e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.unpair(adapter, device); 3227e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disable(adapter); 3237e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 3247e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3257e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe /** 3267e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * Stress test for verifying a PANU connecting and disconnecting with the device. 3277e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * <p> 3287e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * In this test, the local device plays the role of a NAP which a remote PANU connects and 3297e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe * disconnects from. 3307e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe */ 3317e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe public void testIncomingPanConnection() { 3327e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe int iterations = BluetoothTestRunner.sConnectPanIterations; 3337e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe if (iterations == 0) { 3347e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe return; 3357e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 3367e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3377e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 3382b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 3392b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 3407e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.enable(adapter); 3412b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disablePan(adapter); 3427e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.enablePan(adapter); 3432b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 3442b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.acceptPair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 3452b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 3467e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3477e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe for (int i = 0; i < iterations; i++) { 3487e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.writeOutput("incomingPanConnection iteration " + (i + 1) + " of " 3497e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe + iterations); 3507e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.incomingPanConnection(adapter, device); 3517e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.incomingPanDisconnection(adapter, device); 3527e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe } 3537e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe 3547e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.unpair(adapter, device); 3557e4d0c0982cb28a86bf3d45c3b316ec7eab1e017Eric Rowe mTestUtils.disablePan(adapter); 356826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe mTestUtils.disable(adapter); 357826af6266c79d76b81fe850b9cd3d351597e4adbEric Rowe } 358835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe 359835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe /** 360835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe * Stress test for verifying that AudioManager can open and close SCO connections. 361835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe * <p> 362835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe * In this test, a HSP connection is opened with an external headset and the SCO connection is 363835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe * repeatibly opened and closed. 364835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe */ 365835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe public void testStartStopSco() { 366835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe int iterations = BluetoothTestRunner.sStartStopScoIterations; 367835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe if (iterations == 0) { 368835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe return; 369835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe } 370835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe 371835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter(); 3722b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothDevice device = adapter.getRemoteDevice(BluetoothTestRunner.sDeviceAddress); 3732b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disable(adapter); 374835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe mTestUtils.enable(adapter); 3752b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.unpair(adapter, device); 3762b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.pair(adapter, device, BluetoothTestRunner.sDevicePairPasskey, 3772b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe BluetoothTestRunner.sDevicePairPin); 3782b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null); 3792b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.connectProfile(adapter, device, BluetoothProfile.HEADSET, null); 3802b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.stopSco(adapter, device); 381835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe 382835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe for (int i = 0; i < iterations; i++) { 383835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe mTestUtils.writeOutput("startStopSco iteration " + (i + 1) + " of " + iterations); 384835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe mTestUtils.startSco(adapter, device); 385fca8e9d919443449807f87203609e53a64368f6bEric Rowe sleep(SCO_SLEEP_TIME); 386835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe mTestUtils.stopSco(adapter, device); 387fca8e9d919443449807f87203609e53a64368f6bEric Rowe sleep(SCO_SLEEP_TIME); 388835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe } 389835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe 3902b1fb45fabcb6f6e6edfd1a7a8e394928a27afe8Eric Rowe mTestUtils.disconnectProfile(adapter, device, BluetoothProfile.HEADSET, null); 391835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe mTestUtils.unpair(adapter, device); 392835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe mTestUtils.disable(adapter); 393835d8ee61ecddcd3fdc0aadf500d05b914ca375fEric Rowe } 394fca8e9d919443449807f87203609e53a64368f6bEric Rowe 395fca8e9d919443449807f87203609e53a64368f6bEric Rowe private void sleep(long time) { 396fca8e9d919443449807f87203609e53a64368f6bEric Rowe try { 397fca8e9d919443449807f87203609e53a64368f6bEric Rowe Thread.sleep(time); 398fca8e9d919443449807f87203609e53a64368f6bEric Rowe } catch (InterruptedException e) { 399fca8e9d919443449807f87203609e53a64368f6bEric Rowe } 400fca8e9d919443449807f87203609e53a64368f6bEric Rowe } 40114db8d9978daf070f5e66ac8f2cdb1f4ee0dfe06Eric Rowe} 402