@Test
public void shouldThrowExceptionOfHostnameIsMalformed() throws Exception {

    final String dodglyHostName = "{}\\";
    final int port = 9009;
    try {
        jmxUrlFactory.createUrl(dodglyHostName, port);
        fail();
    } catch (final MBeanClientConnectionException expected) {
        assertThat(expected.getMessage(), is("Failed to create JMX service url using host '{}\\' and port 9009"));
        assertThat(expected.getCause(), is(instanceOf(MalformedURLException.class)));
    }
}