@Test
public void connectPeripheralConnectingTest() throws Exception {

    application.grantPermissions(Manifest.permission.ACCESS_COARSE_LOCATION);
    BluetoothPeripheral peripheral = mock(BluetoothPeripheral.class);
    when(peripheral.getAddress()).thenReturn("12:23:34:98:76:54");
    when(peripheral.getType()).thenReturn(BluetoothDevice.DEVICE_TYPE_LE);
    central.connectPeripheral(peripheral, peripheralCallback);
    verify(peripheral).connect();
    central.connectPeripheral(peripheral, peripheralCallback);
    verify(peripheral, times(1)).connect();
}