UPDATE: As pointed out below, the URL class does have some mechanism for handling user authentication. However, the OP is correct that the del.icio.us service returns a 401 using code as shown above (verified with my own account, and I am providing the correct credentials .. sending them in the url unencoded).
Modifying the code slightly, however, works just fine by specifying the Authorization header manually:
URL url = new URL("https://api.del.icio.us/v1/posts/suggest"); byte[] b64 = Base64.encodeBase64("username:pass".getBytes()); URLConnection conn = url.openConnection(); conn.setRequestProperty("Authorization", "Basic " + new String(b64)); BufferedReader r = new BufferedReader(new InputStreamReader(conn.getInputStream())); while(r.ready()){ System.out.println(r.readLine()); }