It sounds like you've got the right process as far as basic authentication is concerned. Here's an example that another community user had from their Java source code, for comparison:
URL categoryUrl = newURL("http://forums.mycompany.com/.../restapi/vc/categories/nested");
BASE64Encoder encoder = new BASE64Encoder();
String encodedCredential = encoder.encode( (userId + ":" + password).getBytes() );
httpUrlConnection.setRequestProperty("Authorization", "BASIC " + encodedCredential);
The first thing I'd suggest is checking to make sure you have the right URL for the call. What happens when you attempt to access the URL in your browser? Do you see a successful response? If your IP address isn't whitelisted, you may need to enter the basic authentication credentials in your browser as well.