@Override
    public Observable<RxBleConnection> establishConnection(boolean autoConnect) {
        return Observable.defer(() -> {
            if (isConnected.compareAndSet(false, true)) {
                return RxBleDeviceMock.this.emitConnectionWithoutCompleting()
                        .doOnSubscribe(disposable -> connectionStateBehaviorSubject.onNext(CONNECTING))
                        .doOnNext(rxBleConnection -> connectionStateBehaviorSubject.onNext(CONNECTED))
                        .doFinally(() -> {
                            connectionStateBehaviorSubject.onNext(DISCONNECTED);
                            isConnected.set(false);
                        });
            } else {
                return Observable.error(new BleAlreadyConnectedException(macAddress));
            }
        });
    }
Set a BLE connection mock. Calling this method is required.
mockrxandroidble/src/main/java/com/polidea/rxandroidble2/mockrxandroidble/RxBleDeviceMock.java