try { System.out.println("--- Storing document ---"); HttpURLConnection connect = getConnection(RESOURCE_URI); connect.setRequestMethod("PUT"); connect.setDoOutput(true); connect.setRequestProperty("ContentType", "text/xml");  Writer writer = new OutputStreamWriter(connect.getOutputStream(), "UTF-8"); writer.write(XML_DATA); writer.close();  connect.connect(); int r = connect.getResponseCode(); assertEquals("Server returned response code " + r, 200, r);  doGet(); } catch (Exception e) { fail(e.getMessage()); } }
try { System.out.println("--- Storing document ---"); HttpURLConnection connect = getConnection(RESOURCE_URI); connect.setRequestProperty("Authorization", "Basic " + credentials); connect.setRequestMethod("PUT"); connect.setDoOutput(true); connect.setRequestProperty("ContentType", "text/xml"); Writer writer = new OutputStreamWriter(connect.getOutputStream(), "UTF-8"); writer.write(XML_DATA); writer.close();  connect.connect(); int r = connect.getResponseCode(); assertEquals("Server returned response code " + r, 200, r);  doGet(); } catch (Exception e) { fail(e.getMessage()); } }
	public void testPut() {		try {			System.out.println("--- Storing document ---");			HttpURLConnection connect = getConnection(RESOURCE_URI);			connect.setRequestMethod("PUT");			connect.setDoOutput(true);			connect.setRequestProperty("ContentType", "text/xml");						Writer writer = new OutputStreamWriter(connect.getOutputStream(), "UTF-8");			writer.write(XML_DATA);			writer.close();						connect.connect();			int r = connect.getResponseCode();			assertEquals("Server returned response code " + r, 200, r);						doGet();	    } catch (Exception e) {            	        fail(e.getMessage()); 	    }	}