### Question:
ConnectExceptionSupport { public static ConnectTimeoutException createConnectTimeoutException( final IOException cause, final NamedEndpoint namedEndpoint, final InetAddress... remoteAddresses) { final String message = "Connect to " + (namedEndpoint != null ? namedEndpoint : "remote endpoint") + (remoteAddresses != null && remoteAddresses.length > 0 ? " " + Arrays.asList(remoteAddresses) : "") + ((cause != null && cause.getMessage() != null) ? " failed: " + cause.getMessage() : " timed out"); return new ConnectTimeoutException(message, namedEndpoint); }  static ConnectTimeoutException createConnectTimeoutException(
            final IOException cause, final NamedEndpoint namedEndpoint, final InetAddress... remoteAddresses); static HttpHostConnectException createHttpHostConnectException(
            final IOException cause,
            final NamedEndpoint namedEndpoint,
            final InetAddress... remoteAddresses); static IOException enhance(
            final IOException cause, final NamedEndpoint namedEndpoint, final InetAddress... remoteAddresses);  }### Answer:
@Test public void testConnectTimeoutExceptionFromNullMessageAndHost() { final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(null, null); Assert.assertEquals("Connect to remote endpoint timed out", ctx.getMessage()); }
@Test public void testConnectTimeoutExceptionFromCause() { final IOException cause = new IOException("something awful"); final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(cause, null); Assert.assertEquals("Connect to remote endpoint failed: something awful", ctx.getMessage()); }
@Test public void testConnectTimeoutExceptionFromCauseAndHost() { final HttpHost target = new HttpHost("localhost"); final IOException cause = new IOException(); final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(cause, target); Assert.assertEquals("Connect to http: }
@Test public void testConnectTimeoutExceptionFromCauseHostAndRemoteAddress() throws Exception { final HttpHost target = new HttpHost("localhost"); final InetAddress remoteAddress = InetAddress.getByAddress(new byte[] {1,2,3,4}); final IOException cause = new IOException(); final ConnectTimeoutException ctx = ConnectExceptionSupport.createConnectTimeoutException(cause, target, remoteAddress); Assert.assertEquals("Connect to http: }