assertEquals (200, connection.getResponseCode());
BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
JAXBContext context = JAXBContext.newInstance(Asset.class);
Unmarshaller un = context.createUnmarshaller();
Asset a = (Asset) un.unmarshal(br);
a.setDescription("An updated description.");
a.getMetadata().setLastModified(new Date(System.currentTimeMillis()));
connection.disconnect();
HttpURLConnection conn2 = (HttpURLConnection)url.openConnection();
Marshaller ma = context.createMarshaller();
conn2.setRequestMethod("PUT");
conn2.setRequestProperty("Content-Type", MediaType.APPLICATION_XML);
conn2.setRequestProperty("Content-Length", Integer.toString(a.toString().getBytes().length));
conn2.setUseCaches (false);
conn2.setDoInput(true);
conn2.setDoOutput(true);
ma.marshal(a, conn2.getOutputStream());
assertEquals (200, connection.getResponseCode());