private void setupBasicCredentials(Credentials credentials,
URLConnection urlCon) {
// Currently we are only handling Basic scheme username/password encoding
if ((credentials != null) && (credentials instanceof UsernamePasswordCredentials)) {
UsernamePasswordCredentials upCredentials =
(UsernamePasswordCredentials) credentials;
String sUsername = upCredentials.getUsername();
String sPassword = upCredentials.getPassword();
if ((sUsername.length() > 0) || (sPassword.length() > 0)) {
String sUserPwd = sUsername + ":" + sPassword;
String sEncodedUserPwd = "";
try {
sEncodedUserPwd = Base64.encode(sUserPwd, null);