For me, it worked,
final String basicAuth = "Basic " + Base64.encodeToString("user:password".getBytes(), Base64.NO_WRAP);
Apache HttpCLient:
request.setHeader("Authorization", basicAuth);
HttpUrlConnection:
connection.setRequestProperty ("Authorization", basicAuth);
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…