Buggy code:
public class MinecraftDownloaderBuilder { public static MinecraftDownloaderBuilder create ( ) { } private int maxConnections ; private int maxConnectionsPerRouter ; private MinecraftDownloadProvider baseProvider = new MojangDownloadProvider ( ) ; private List < MinecraftDownloadProvider > appendProviders = new ArrayList < > ( ) ; private int poolMaxThreads = Runtime . getRuntime ( ) . availableProcessors ( ) ; private long poolThreadLivingTime = 1000 * 10 ; private int defaultTries = 3 ; private int connectTimeout = 10000 ; private int soTimeout = 30000 ; private boolean disableApacheHttpAsyncClient = false ; private boolean useVersionDownloadInfo = true ; private Proxy proxy = Proxy . NO_PROXY ; private boolean checkLibrariesHash = true ; private boolean checkAssetsHash = true ; protected MinecraftDownloaderBuilder ( ) { } public MinecraftDownloaderBuilder setMaxConnections ( int maxConnections ) { } public MinecraftDownloaderBuilder setMaxConnectionsPerRouter ( int maxConnectionsPerRouter ) { } public MinecraftDownloaderBuilder setBaseProvider ( MinecraftDownloadProvider baseprovider ) { } public MinecraftDownloaderBuilder setPoolMaxThreads ( int poolMaxThreads ) { } public MinecraftDownloaderBuilder setPoolThreadLivingTime ( long poolThreadLivingTime ) { } public MinecraftDownloaderBuilder setDefaultTries ( int defaultTries ) { } public MinecraftDownloaderBuilder setConnectTimeout ( int connectTimeout ) { } public MinecraftDownloaderBuilder setSoTimeout ( int soTimeout ) { } public MinecraftDownloaderBuilder appendProvider ( MinecraftDownloadProvider appendProvider ) { } public MinecraftDownloaderBuilder disableApacheHttpAsyncClient ( ) { } public MinecraftDownloaderBuilder setUseVersionDownloadInfo ( boolean useVersionDownloadInfo ) { } public MinecraftDownloaderBuilder setProxy ( Proxy proxy ) { } public MinecraftDownloaderBuilder setCheckLibrariesHash ( boolean checkLibrariesHash ) { } public MinecraftDownloaderBuilder setCheckAssetsHash ( boolean checkAssetsHash ) { } public MinecraftDownloader build ( ) { ExecutorService executor = null ; DownloaderService downloader = null ; MinecraftDownloader mcdownloader = null ; try { MinecraftDownloadProvider provider = resolveProvider ( ) ; executor = new ThreadPoolExecutor ( poolMaxThreads , poolMaxThreads , poolThreadLivingTime , TimeUnit . MILLISECONDS , new LinkedBlockingQueue < Runnable > ( ) ) ; if ( ( ! ( disableApacheHttpAsyncClient ) ) && ( MinecraftDownloaderBuilder . isApacheHttpAsyncClientAvailable ( ) ) ) { HttpHost proxyHost = resolveProxy ( ) ; <START_BUG> HttpAsyncClientBuilder httpClientBuilder = HttpAsyncClientBuilder . create ( ) . setMaxConnTotal ( maxConnections ) . setMaxConnPerRoute ( maxConnectionsPerRouter ) . setProxy ( proxyHost ) . setDefaultIOReactorConfig ( org . apache . http . impl . nio . reactor . IOReactorConfig . custom ( ) . setConnectTimeout ( connectTimeout ) . setSoTimeout ( soTimeout ) . build ( ) ) . setDefaultRequestConfig ( org . apache . http . client . config . RequestConfig . custom ( ) . setConnectTimeout ( connectTimeout ) . setSocketTimeout ( soTimeout ) . setProxy ( proxyHost ) . build ( ) ) ; <END_BUG> downloader = new org . to2mbn . jmccc . mcdownloader . download . HttpAsyncDownloader ( httpClientBuilder , executor ) ; } else { downloader = new JreHttpDownloader ( ( ( maxConnections ) > 0 ? maxConnections : ( Runtime . getRuntime ( ) . availableProcessors ( ) ) * 2 ) , connectTimeout , soTimeout , poolThreadLivingTime , proxy ) ; } mcdownloader = new MinecraftDownloaderImpl ( downloader , executor , provider , defaultTries , checkLibrariesHash , checkAssetsHash ) ; } catch ( Throwable e ) { if ( executor != null ) { try { executor . shutdown ( ) ; } catch ( Throwable e1 ) { e . addSuppressed ( e1 ) ; } } if ( downloader != null ) { try { downloader . shutdown ( ) ; } catch ( Throwable e1 ) { e . addSuppressed ( e1 ) ; } } if ( mcdownloader != null ) { try { mcdownloader . shutdown ( ) ; } catch ( Throwable e1 ) { e . addSuppressed ( e1 ) ; } } throw e ; } return mcdownloader ; } private HttpHost resolveProxy ( ) { } private static boolean isApacheHttpAsyncClientAvailable ( ) { } private MinecraftDownloadProvider resolveProvider ( ) { } private MinecraftDownloadProvider resolveBeginningProvider ( MinecraftDownloadProvider right ) { } protected List < MinecraftDownloadProvider > createBeginningProviders ( ) { } }

Fix:
HttpAsyncClientBuilder httpClientBuilder = HttpAsyncClientBuilder . create ( ) . setMaxConnTotal ( maxConnections ) . setMaxConnPerRoute ( ( ( maxConnectionsPerRouter ) == 0 ? maxConnections : maxConnectionsPerRouter ) ) . setProxy ( proxyHost ) . setDefaultIOReactorConfig ( org . apache . http . impl . nio . reactor . IOReactorConfig . custom ( ) . setConnectTimeout ( connectTimeout ) . setSoTimeout ( soTimeout ) . build ( ) ) . setDefaultRequestConfig ( org . apache . http . client . config . RequestConfig . custom ( ) . setConnectTimeout ( connectTimeout ) . setSocketTimeout ( soTimeout ) . setProxy ( proxyHost ) . build ( ) ) ;