@Test public void shouldHandleAnExceptionThrownDuringClosingTheSocket() throws IOException {

  // given
  final String errorMsg = "Could not close the socket";
  final IOException givenException = new IOException(errorMsg);
  doThrow(givenException).when(socket).close();
  // when
  strategy.isConnected(socket, getHost(), PORT, TIMEOUT_IN_MS, errorHandler);
  // then
  verify(errorHandler, times(1)).handleError(givenException, errorMsg);
}