<commit_before>package com.tenable.io.core.services;


import com.fasterxml.jackson.databind.JsonNode;
import com.tenable.io.core.exceptions.TenableIoException;
import com.tenable.io.core.exceptions.TenableIoErrorCode;
import com.tenable.io.core.utilities.JsonHelper;
import javafx.util.Pair;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.*;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.nio.client.methods.HttpAsyncMethods;
import org.apache.http.nio.client.methods.ZeroCopyConsumer;
import org.apache.http.nio.entity.NStringEntity;
import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.ssl.TrustStrategy;

import javax.net.ssl.SSLContext;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.URI;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;


/**
 * Copyright (c) 2017 Tenable Network Security, Inc.
 */
public class AsyncHttpService implements AutoCloseable {
    private static int CONNECTION_REQUEST_TIMEOUT = 30000;
    private static int CONNECTION_TIMEOUT = 30000;
    private static int SOCKET_TIMEOUT = 60000; // 1 min

    private CloseableHttpAsyncClient asyncClient = null;
    private JsonHelper jsonHelper;
    private List<Header> defaultHeaders;


    /**
     * Instantiates a new Async http service.
     * Note: if JVM variables "proxyHost" and "proxyPort" are set, it will use it.
     * This feature is meant to be used for development/debug only and will TURN OFF SSL VALIDATION
     *
     * @param accessKey the access key
     * @param secretKey the secret key
     */
    public AsyncHttpService( String accessKey, String secretKey ) {<commit_msg>increased API timeout to 2 min<commit_after>package com.tenable.io.core.services;


import com.fasterxml.jackson.databind.JsonNode;
import com.tenable.io.core.exceptions.TenableIoException;
import com.tenable.io.core.exceptions.TenableIoErrorCode;
import com.tenable.io.core.utilities.JsonHelper;
import javafx.util.Pair;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.*;
import org.apache.http.entity.BufferedHttpEntity;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.mime.HttpMultipartMode;
import org.apache.http.entity.mime.MultipartEntityBuilder;
import org.apache.http.impl.nio.client.CloseableHttpAsyncClient;
import org.apache.http.impl.nio.client.HttpAsyncClients;
import org.apache.http.message.BasicHeader;
import org.apache.http.nio.client.methods.HttpAsyncMethods;
import org.apache.http.nio.client.methods.ZeroCopyConsumer;
import org.apache.http.nio.entity.NStringEntity;
import org.apache.http.nio.protocol.HttpAsyncResponseConsumer;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.ssl.TrustStrategy;

import javax.net.ssl.SSLContext;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.lang.management.ManagementFactory;
import java.lang.management.RuntimeMXBean;
import java.net.URI;
import java.security.cert.CertificateException;
import java.security.cert.X509Certificate;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;


/**
 * Copyright (c) 2017 Tenable Network Security, Inc.
 */
public class AsyncHttpService implements AutoCloseable {
    private static int CONNECTION_REQUEST_TIMEOUT = 30000;
    private static int CONNECTION_TIMEOUT = 30000;
    private static int SOCKET_TIMEOUT = 1200000; // 2 mins

    private CloseableHttpAsyncClient asyncClient = null;
    private JsonHelper jsonHelper;
    private List<Header> defaultHeaders;


    /**
     * Instantiates a new Async http service.
     * Note: if JVM variables "proxyHost" and "proxyPort" are set, it will use it.
     * This feature is meant to be used for development/debug only and will TURN OFF SSL VALIDATION
     *
     * @param accessKey the access key
     * @param secretKey the secret key
     */
    public AsyncHttpService( String accessKey, String secretKey ) {
{'fraction_non_alphanumeric': 0.09508589692369157, 'fraction_numerical': 0.009788254095085897, 'mean_word_length': 4.960714285714285, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '15374', 'n_tokens_mistral': 1524, 'n_tokens_neox': 1460, 'n_words': 341}