@BeforeClass public void setUpOnceAgain() throws Exception { File dataLocation = new File("generated"); m_200file = File.createTempFile("download", ".bin", dataLocation); m_200file.deleteOnExit(); int port = 8883; m_200url = new URL("http://localhost:" + port + "/" + m_200file.getName()); m_404url = new URL("http://localhost:" + port + "/error?status=404"); m_503url = new URL("http://localhost:" + port + "/error?status=503&retry=500"); DigestOutputStream dos = new DigestOutputStream(new FileOutputStream(m_200file), MessageDigest.getInstance("MD5")); for (int i = 0; i < 10000; i++) { dos.write(String.valueOf(System.currentTimeMillis()).getBytes()); dos.write(" Lorum Ipsum Lorum Ipsum Lorum Ipsum Lorum Ipsum Lorum Ipsum\n".getBytes()); } dos.close(); m_200digest = new String(dos.getMessageDigest().digest()); m_webServer = new TestWebServer(port, "/", dataLocation.getName()); m_webServer.addServlet(new TestErrorServlet(), "/error"); m_webServer.start(); m_agentContextImpl = mockAgentContext(); m_agentContext = m_agentContextImpl; BundleContext bc = mockBundleContext(); m_agentContextImpl.setHandler(EventsHandler.class, new EventsHandlerImpl(bc)); m_agentContextImpl.setHandler(ConnectionHandler.class, new ConnectionHandlerImpl()); m_agentContextImpl.setHandler(LoggingHandler.class, new LoggingHandlerImpl(bc, Levels.DEBUG)); m_agentContextImpl.setHandler(DownloadHandler.class, new DownloadHandlerImpl(dataLocation)); m_agentContextImpl.start(); replayTestMocks(); }