@Test public void shouldNotBeConnectedToTheInternetWhenSocketThrowsAnExceptionOnConnect()
    throws IOException {

  // given
  final InetSocketAddress address = new InetSocketAddress(getHost(), PORT);
  doThrow(new IOException()).when(socket).connect(address, TIMEOUT_IN_MS);
  // when
  final boolean isConnected =
      strategy.isConnected(socket, getHost(), PORT, TIMEOUT_IN_MS, errorHandler);
  // then
  assertThat(isConnected).isFalse();
}