private ReactorClientHttpConnector initConnector() { if (bufferFactory instanceof NettyDataBufferFactory) { ByteBufAllocator allocator = ((NettyDataBufferFactory) bufferFactory).getByteBufAllocator(); return new ReactorClientHttpConnector(this.factory, httpClient -> httpClient.tcpConfiguration(tcpClient -> tcpClient.option(ChannelOption.ALLOCATOR, allocator))); } else { return new ReactorClientHttpConnector(); } }
private void verifyAllocations() { if (this.bufferFactory instanceof NettyDataBufferFactory) { ByteBufAllocator allocator = ((NettyDataBufferFactory) this.bufferFactory).getByteBufAllocator(); if (allocator instanceof PooledByteBufAllocator) { PooledByteBufAllocatorMetric metric = ((PooledByteBufAllocator) allocator).metric(); long total = getAllocations(metric.directArenas()) + getAllocations(metric.heapArenas()); assertEquals("ByteBuf Leak: " + total + " unreleased allocations", 0, total); } } }