title: convert curl call into java urlconnection call
body: <p>I have curl command:</p>
  
  <pre><code>curl -i -u guest:guest -H "content-type:application/json"
  -XPUT \ http://localhost:15672/api/traces/%2f/my-trace \
  -d'{"format":"text","pattern":"#"}'
  </code></pre>
  
  <p>And I want to create HTTP Request in Java API which will do the same thing. This curl command can be found in this <a href="https://github.com/rabbitmq/rabbitmq-tracing/blob/master/README" rel="noreferrer">README</a>. It is used to start recording log on RabbitMQ. Response is not important.</p>
  
  <p>For now I created something like this (I've deleted less important lines i.e. with catching exception etc.), but unfortunately it doesn't work:</p>
  
  <pre><code>url = new URL("http://localhost:15672/api/traces/%2f/my-trace");
  uc = url.openConnection();
  
  uc.setRequestProperty("Content-Type", "application/json");
  uc.setRequestProperty("format","json");
  uc.setRequestProperty("pattern","#")
  String userpass = "guest:guest";
  String basicAuth = "Basic " + javax.xml.bind.DatatypeConverter.printBase64Binary(userpass.getBytes());
  uc.setRequestProperty ("Authorization", basicAuth);
  </code></pre>
  
  <p><a href="http://pastebin.com/RFARk3jA" rel="noreferrer">ENTIRE CODE</a></p>