Closed rucko24 closed 4 months ago
@Test @DisplayName("Leyendo line a linea un inputStream decodificado para poder leer bien, sin mapping extraños") void testRead() { final var countDownLatch = new CountDownLatch(1); DataBufferUtils.readInputStream(() -> this.commandService.execute(getIpAddressInfo()) .getInputStream(), DefaultDataBufferFactory.sharedInstance, FileCopyUtils.BUFFER_SIZE) .transformDeferred(this::stringDecoder) .delayElements(Duration.ofSeconds(1)) .log() .doOnTerminate(countDownLatch::countDown) .subscribe(); try { countDownLatch.await(); } catch (InterruptedException e) { throw new RuntimeException(e); } } private Flux<String> stringDecoder(Flux<DataBuffer> dataBuffer) { return StringDecoder.allMimeTypes().decode(dataBuffer,null, null, null); }