@Test
public void writeCharacteristicNotConnectedTest() throws Exception {

    ShadowLooper.runUiThreadTasksIncludingDelayedTasks();
    BluetoothGattCharacteristic characteristic = new BluetoothGattCharacteristic(UUID.fromString("00002A1C-0000-1000-8000-00805f9b34fb"), PROPERTY_WRITE,0);
    when(gatt.writeCharacteristic(characteristic)).thenReturn(true);
    peripheral.writeCharacteristic(characteristic, new byte[]{0}, WRITE_TYPE_DEFAULT);
    verify(gatt, never()).writeCharacteristic(any(BluetoothGattCharacteristic.class));
}