I resolved the problem, through adding this line before connect() method:
String userpassword = "key_authentication"+":"+""; // empty password should not be missed
String encoded = new String(Base64.encode(userpassword.getBytes(), Base64.DEFAULT));
connection.setRequestProperty("Authorization", "Basic " + encoded);