### Question:
ApnsFeedbackConnection { public Map<String, Date> getInactiveDevices() throws NetworkIOException { int attempts = 0; while (true) { try { attempts++; Map<String, Date> result = getInactiveDevicesImpl(); attempts = 0; return result; } catch (Exception e) { logger.warn("Failed to retreive invalid devices", e); if (attempts >= RETRIES) { logger.error("Couldn't get feedback connection", e); Utilities.wrapAndThrowAsRuntimeException(e); } Utilities.sleep(DELAY_IN_MS); } } } ApnsFeedbackConnection(SocketFactory factory, String host, int port);  ApnsFeedbackConnection(SocketFactory factory, String host, int port,
            Proxy proxy); Map<String, Date> getInactiveDevices(); Map<String, Date> getInactiveDevicesImpl();  }### Answer:
@Test public void connectionParsedOne() { SocketFactory sf = MockingUtils.mockSocketFactory(null, simpleStream); ApnsFeedbackConnection connection = new ApnsFeedbackConnection(sf, "localhost", 80); checkParsedSimple(connection.getInactiveDevices()); }
@Test public void connectionParsedThree() { SocketFactory sf = MockingUtils.mockSocketFactory(null, threeStream); ApnsFeedbackConnection connection = new ApnsFeedbackConnection(sf, "localhost", 80); checkParsedThree(connection.getInactiveDevices()); }
@Test public void feedbackWithclosedSocket() { SocketFactory sf = mockClosedThenOpenSocket(null, simpleStream, true, 1); ApnsFeedbackConnection connection = new ApnsFeedbackConnection(sf, "localhost", 80); connection.DELAY_IN_MS = 0; checkParsedSimple(connection.getInactiveDevices()); }
@Test public void feedbackWitherrorOnce() { SocketFactory sf = mockClosedThenOpenSocket(null, simpleStream, true, 2); ApnsFeedbackConnection connection = new ApnsFeedbackConnection(sf, "localhost", 80); connection.DELAY_IN_MS = 0; checkParsedSimple(connection.getInactiveDevices()); }
@Test(expected = Exception.class) public void feedbackWitherrorTwice() { SocketFactory sf = mockClosedThenOpenSocket(null, simpleStream, true, 3); ApnsFeedbackConnection connection = new ApnsFeedbackConnection(sf, "localhost", 80); connection.DELAY_IN_MS = 0; checkParsedSimple(connection.getInactiveDevices()); }