@Test(timeout = 1000*60*60)
public void testPartitionByClientId() throws Exception {

    partitioning.byClientId = new HashMap<String, Target>();
    partitioning.byClientId.put("client1", new Target("broker1"));
    partitioning.byClientId.put("client2", new Target("broker2"));
    createBrokerCluster(2);
    Connection connection = createConnectionTo("broker2");
    within(5, TimeUnit.SECONDS, new Task() {
        public void run() throws Exception {
            assertEquals(0, getTransportConnector("broker1").getConnections().size());
            assertEquals(1, getTransportConnector("broker2").getConnections().size());
        }
    });
    connection.setClientID("client1");
    connection.start();
    within(5, TimeUnit.SECONDS, new Task() {
        public void run() throws Exception {
            assertEquals(1, getTransportConnector("broker1").getConnections().size());
            assertEquals(0, getTransportConnector("broker2").getConnections().size());
        }
    });
}