@Test
public void shouldGetOrderByIdWhenOnDifferentHost() throws Exception {

  OrderBean order = new OrderBean(id(1L), 2L, OrderState.VALIDATED, Product.JUMPERS, 10, 100d);
  int port1 = randomFreeLocalPort();
  int port2 = randomFreeLocalPort();
  final Client client = ClientBuilder.newClient();
  //Given two rest servers on different ports
  Paths paths1 = new Paths("localhost", port1);
  Paths paths2 = new Paths("localhost", port2);
  rest = new OrdersService(new HostInfo("localhost", port1));
  rest.start(CLUSTER.bootstrapServers());
  rest2 = new OrdersService(new HostInfo("localhost", port2));
  rest2.start(CLUSTER.bootstrapServers());
  //And one order
  client.target(paths1.urlPost())
      .request(APPLICATION_JSON_TYPE)
      .post(Entity.json(order));
  //When GET to rest1
  OrderBean returnedOrder = client.target(paths1.urlGet(order.getId()))
      .queryParam("timeout", MIN / 2)
      .request(APPLICATION_JSON_TYPE)
      .get(new GenericType<OrderBean>() {
      });
  //Then we should get the order back
  assertThat(returnedOrder).isEqualTo(order);
  //When GET to rest2
  returnedOrder = client.target(paths2.urlGet(order.getId()))
      .queryParam("timeout", MIN / 2)
      .request(APPLICATION_JSON_TYPE)
      .get(new GenericType<OrderBean>() {
      });
  //Then we should get the order back also
  assertThat(returnedOrder).isEqualTo(order);
}