Stack Exchange
Request doesn't work with HttpURLConnection but works with other HTTP client
OkHttpClient client = new OkHttpClient();
Request request = new Request.Builder()
        .url("http://some.cz/url")
        .post(new FormBody.Builder().build())
        .addHeader("Jenkins-Crumb", "325asdfse534")
        .addHeader("Authorization", "Basic 5645762535t")
        .addHeader("Cache-Control", "no-cache")
        .addHeader("Postman-Token", "563b8065-87b0-47a4-b9af-eaaeaaab4bb0")
        .build();
System.out.println("response.code() = " + client.newCall(request).execute().code());

With this code the status code is 200.
HttpURLConnection connection = (HttpURLConnection)
        new URL("http://some.cz/url").openConnection();
connection.setRequestProperty("Jenkins-Crumb", "325asdfse534");
connection.setRequestProperty("Authorization", "Basic 5645762535t");
connection.setRequestProperty("Cache-Control", "no-cache");
connection.setRequestProperty("Postman-Token", "563b8065-87b0-47a4-b9af-eaaeaaab4bb0");
connection.setDoOutput(true);
connection.setRequestMethod("POST");
connection.getOutputStream().write(new byte[0]);
System.out.println("connection.getResponseCode() = " + connection.getResponseCode());

Here the status code is 403. What is the difference?

Try to add
connection.setRequestProperty("Content-Type", "application/x-www-form-urlencoded");

