title: Find out how Postman request is constructed and replicate in java
body: <p>I am making a GET request using Postman. As part of the request, I selected <code>Authorization</code>, <code>Basic Auth</code> and then I filled in my username and password.</p>
  
  <p>The request was successful. Now, I would like to replicate this in Java code.</p>
  
  <p>In Java I tried this:</p>
  
  <pre><code>URL myURL = new URL(serviceURL);
  HttpURLConnection myURLConnection = (HttpURLConnection)myURL.openConnection();
  String userCredentials = "username:password";
  myURLConnection.setRequestProperty ("Authorization", userCredentials);
  </code></pre>
  
  <p>Although this seems to be similar to what Postman does, it doesn't work.</p>
  
  <p>How can I replicate the above Postman request in Java?</p>