Pq é preciso informar o "https://" antes do caminho para a busca.
String URLconsulta = "https://viacep.com.br/ws/" + cepNumber + "/json/";
HttpClient client = HttpClient.newHttpClient(); HttpRequest request = HttpRequest.newBuilder().uri(URI.create(URLconsulta)).build(); HttpResponse response = client.send(request, HttpResponse.BodyHandlers.ofString());