When I set \"Authorization\" header with setHeader from HttpPost then hostname disappears from request and there is always error 400 (bad request) returned. Same code is wor
use simply this :
String authorizationString = "Basic " + Base64.encodeToString( ("your_login" + ":" + "your_password").getBytes(), Base64.NO_WRAP); //Base64.NO_WRAP flag post.setHeader("Authorization", authorizationString);