@SuppressWarnings({"unchecked"})

@Test
public void shouldGetConnector() throws Exception
{
    String                                   url        = "service:jmx:rmi:///jndi/rmi://localhost:40000/jmxrmi";
    DeferredJMXConnector.JMXConnectorBuilder builder    = mock(DeferredJMXConnector.JMXConnectorBuilder.class);
    JMXConnector                             connector  = mock(JMXConnector.class);
    JMXServiceURL                            serviceURL = new JMXServiceURL(url);
    when(builder.realize(eq(serviceURL), anyMap())).thenReturn(connector);
    DeferredJMXConnector deferred = new DeferredJMXConnector(url, builder);
    assertThat(deferred.get(), is(sameInstance(connector)));
}