0
    private HttpsURLConnection getConnection(String path, Map<String, String> postParamMap) throws IOException {
        URL url = new URL(PROTOCOL + host + path);
        this.requestUrl = url;
        LOGGER.info("Connecting to: " + url);
        HttpsURLConnection connection = (HttpsURLConnection) url.openConnection();
        connection.setConnectTimeout(TIMEOUT);
        connection.setReadTimeout(TIMEOUT);
        connection.setInstanceFollowRedirects(false);
        if (this.cookieMap.size() > 0) {
            List<String> cookieList = cookieMap2List(this.cookieMap);
            String cookieRequestValue = Utils.join(cookieList.toArray(new String[cookieList.size()]), COOKIE_VALUE_SEPARATOR);
            LOGGER.info("Setting cookies: " + cookieRequestValue);
            connection.setRequestProperty(COOKIE_REQUEST_HEADER, cookieRequestValue);
        } 
        connection.setRequestProperty(ACCEPT_CHARSET, UTF_8);
        if (postParamMap != null && postParamMap.size()>0) {
            LOGGER.debug("This is a POST."); 
            // This is a POST 
            connection.setRequestMethod(HTTP_METHOD_POST);
            connection.setRequestProperty(CONTENT_TYPE, POST_CONTENT_TYPE);
            List<String> postParamList = postParamMap2List(postParamMap);
            String postParamRequestValue = Utils.join(postParamList.toArray(new String[postParamList.size()]), POST_PARAM_VALUE_SEPARATOR);
            LOGGER.debug("Post Param Request Value: " + postParamRequestValue);
            connection.setDoOutput(true);
            Writer writer = new OutputStreamWriter(connection.getOutputStream());
            writer.write(postParamRequestValue);
            writer.close();
        } 
        connection.connect();
//        debugConnection(connection); 
        this.cookieMap.putAll(getCookies(connection.getHeaderFields()));
        LOGGER.info("Aantal cookies: " + this.cookieMap.size());
        if (connection.getResponseCode() >= HttpURLConnection.HTTP_MULT_CHOICE && connection.getResponseCode() < HttpURLConnection.HTTP_BAD_REQUEST) {
            // This is a 3xx redirect 
            String relocatedTo = connection.getHeaderField(REDIRECT_LOCATION_HEADER);
            if (relocatedTo != null) {
                if (relocatedTo.startsWith(PROTOCOL + host)) {
                    LOGGER.info("Absolute redirection"); 
                    URL relocateUrl = new URL(relocatedTo);
                    this.requestUrl = relocateUrl;