### Question:
CorePeripheral implements Peripheral { @TargetApi(21) @Override public Single<Integer> requestMtu(int mtu) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) { return Single.error(new PeripheralError(PeripheralError.Code.MINIMUM_SDK_UNSUPPORTED)); } final SingleSubject<Integer> scopedSubject = SingleSubject.create(); return scopedSubject .doOnSubscribe(disposable -> processRequestMtu(scopedSubject, mtu)) .doFinally(() -> clearRequestMtuSubject(scopedSubject)); } CorePeripheral(BluetoothDevice device, Context context); @Override Observable<ConnectableState> connect(); @Override Observable<Boolean> connected(); @Override Single<byte[]> read(UUID svc, UUID chr); @Override Completable write(UUID svc, UUID chr, byte[] data); @Override Completable registerNotification(UUID svc, UUID chr); @Override Completable registerNotification(UUID svc, UUID chr, @Nullable Preprocessor preprocessor); @Override Completable unregisterNotification(UUID svc, UUID chr); @Override Observable<byte[]> notification(UUID chr); @TargetApi(21) @Override Single<Integer> requestMtu(int mtu); @Override Single<Integer> readRssi(); @Override int getMaxWriteLength(); @Override void disconnect();  }### Answer:
@Test public void setMtu_disconnected() { setMtuTestObserver = corePeripheral.requestMtu(100).test(); setMtuTestObserver.assertError( throwable -> { PeripheralError error = (PeripheralError) throwable; return error != null && error.getCode() == DISCONNECTED; }); }