source: class DockerClientBuilderTest {
  
      private static final int AMOUNT;
  
      @Test
      public void testConcurrentClientBuilding() throws Exception {
  
target:         // we use it to check instance uniqueness
          final Set<DockerCmdExecFactory> instances = Collections.synchronizedSet(new HashSet<>());
  
          Runnable runnable = () -> {
              DockerCmdExecFactory factory = DockerClientBuilder.getDefaultDockerCmdExecFactory();
              // factory created
              assertNotNull(factory);
              // and is unique
              assertFalse(instances.contains(factory));
              instances.add(factory);
          };
  
          parallel(AMOUNT, runnable);
          // set contains all required unique instances
          assertEquals(instances.size(), AMOUNT);
      }
  
  }