* @throws NamespaceException
* @throws IOException
*/
public void testGETResponseBinaryContent() throws ServletException, NamespaceException, IOException
{
HttpService httpService = getHTTPService( registry.getBundleContext() );
byte[] content = generateRandomBinaryContent();
BasicTestingServlet testServlet = new BasicTestingServlet( content, false );
httpService.registerServlet( "/test", testServlet, null, null );
HttpURLConnection client = getConnection( DEFAULT_BASE_URL + "/test", "GET" );
client.connect();
assertTrue( client.getResponseCode() == 200 );
byte[] response = readInputAsByteArray( client.getInputStream() );
printBytes( content );
printBytes( response );
assertTrue( content.length == response.length );
for (int i = 0; i < content.length; ++i)
{
assertTrue( content[i] == response[i] );
}
httpService.unregister( "/test" );
}