참고자료: https://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html#setConnectTimeout-int-
https://docs.oracle.com/javase/8/docs/api/java/net/URLConnection.html#setReadTimeout-int-
오늘은 Java에서 REST API를 호출할 때, Timeout을 설정하는 방법에 대해 알아보겠습니다🤩
URL url = new URL("http://www.google.com");
HttpURLConnection conn = (HttpURLConnection)url.openConnection();
conn.setConnectTimeout(1000); // 1초
conn.setReadTimeout(1000); // 1초