Source:
private Mono<PollStrategy> createProvisioningStateOrCompletedPollStrategy(final HttpRequest httpRequest, HttpResponse httpResponse, final SwaggerMethodParser methodParser, final long delayInMilliseconds) { Mono<PollStrategy> pollStrategyMono; final HttpMethod httpRequestMethod = httpRequest.httpMethod(); if (httpRequestMethod == HttpMethod.DELETE || httpRequestMethod == HttpMethod.GET || httpRequestMethod == HttpMethod.HEAD || !methodParser.expectsResponseBody()) { pollStrategyMono = Mono.<PollStrategy>just(new CompletedPollStrategy( new CompletedPollStrategy.CompletedPollStrategyData(AzureProxy.this, methodParser, httpResponse))); } else { final HttpResponse bufferedOriginalHttpResponse = httpResponse.buffer(); pollStrategyMono = bufferedOriginalHttpResponse.bodyAsString() .map(originalHttpResponseBody -> { if (originalHttpResponseBody == null || originalHttpResponseBody.isEmpty()) { throw logger.logExceptionAsError(new CloudException("The HTTP response does not contain a " + "body.", bufferedOriginalHttpResponse)); } PollStrategy pollStrategy; try { final SerializerAdapter serializer = serializer(); final ResourceWithProvisioningState resource = serializer.deserialize(originalHttpResponseBody, ResourceWithProvisioningState.class, SerializerEncoding.JSON); if (resource != null && resource.properties() != null && !OperationState.isCompleted(resource.properties().provisioningState())) { pollStrategy = new ProvisioningStatePollStrategy( new ProvisioningStatePollStrategy.ProvisioningStatePollStrategyData( AzureProxy.this, methodParser, httpRequest, resource.properties().provisioningState(), delayInMilliseconds)); } else { pollStrategy = new CompletedPollStrategy( new CompletedPollStrategy.CompletedPollStrategyData( AzureProxy.this, methodParser, bufferedOriginalHttpResponse)); } } catch (IOException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } return pollStrategy; }); } return pollStrategyMono; }

Target:
private Mono<PollStrategy> createProvisioningStateOrCompletedPollStrategy(final HttpRequest httpRequest, HttpResponse httpResponse, final SwaggerMethodParser methodParser, final long delayInMilliseconds) { Mono<PollStrategy> pollStrategyMono; final HttpMethod httpRequestMethod = httpRequest.httpMethod(); if (httpRequestMethod == HttpMethod.DELETE || httpRequestMethod == HttpMethod.GET || httpRequestMethod == HttpMethod.HEAD || !methodParser.expectsResponseBody()) { pollStrategyMono = Mono.just(new CompletedPollStrategy( new CompletedPollStrategy.CompletedPollStrategyData(AzureProxy.this, methodParser, httpResponse))); } else { final HttpResponse bufferedOriginalHttpResponse = httpResponse.buffer(); pollStrategyMono = bufferedOriginalHttpResponse.bodyAsString() .map(originalHttpResponseBody -> { if (originalHttpResponseBody == null || originalHttpResponseBody.isEmpty()) { throw logger.logExceptionAsError(new CloudException( "The HTTP response does not contain a body.", bufferedOriginalHttpResponse)); } PollStrategy pollStrategy; try { final SerializerAdapter serializer = serializer(); final ResourceWithProvisioningState resource = serializer.deserialize(originalHttpResponseBody, ResourceWithProvisioningState.class, SerializerEncoding.JSON); if (resource != null && resource.properties() != null && !OperationState.isCompleted(resource.properties().provisioningState())) { pollStrategy = new ProvisioningStatePollStrategy( new ProvisioningStatePollStrategy.ProvisioningStatePollStrategyData( AzureProxy.this, methodParser, httpRequest, resource.properties().provisioningState(), delayInMilliseconds)); } else { pollStrategy = new CompletedPollStrategy( new CompletedPollStrategy.CompletedPollStrategyData( AzureProxy.this, methodParser, bufferedOriginalHttpResponse)); } } catch (IOException e) { throw logger.logExceptionAsError(Exceptions.propagate(e)); } return pollStrategy; }); } return pollStrategyMono; }