@Test
public void testPushMetricsFailed() throws Exception {

  final UrlService svcMock = createStrictMock(UrlService.class);
  final String payload = "test";
  final String expectedResponse = "mockResponse";
  RestMetricsSender sender = new RestMetricsSender("expectedHostName") {
    @Override
    protected UrlService getConnectedUrlService() throws IOException {
      return svcMock;
    }
  };
  expect(svcMock.send(anyString())).andThrow(new IOException());
  svcMock.disconnect();
  expectLastCall();
  replay(svcMock);
  String response = sender.pushMetrics(payload);
  verify(svcMock);
}