public static void throttleAllBrokersReplication(Admin adminClient, List<Integer> brokerIds, int throttleBytes) throws ExecutionException, InterruptedException {
        List<AlterConfigOp> throttleConfigs = new ArrayList<>();
        throttleConfigs.add(new AlterConfigOp(new ConfigEntry(QuotaConfigs.LEADER_REPLICATION_THROTTLED_RATE_CONFIG,
            Integer.toString(throttleBytes)), AlterConfigOp.OpType.SET));
        throttleConfigs.add(new AlterConfigOp(new ConfigEntry(QuotaConfigs.FOLLOWER_REPLICATION_THROTTLED_RATE_CONFIG,
            Integer.toString(throttleBytes)), AlterConfigOp.OpType.SET));

        Map<ConfigResource, Collection<AlterConfigOp>> configs = new HashMap<>();
        for (int brokerId : brokerIds) {
            ConfigResource configResource = new ConfigResource(ConfigResource.Type.BROKER, Integer.toString(brokerId));
            configs.put(configResource, throttleConfigs);
        }

        adminClient.incrementalAlterConfigs(configs).all().get();
    }
Throttles all replication across the cluster.
@param adminClient is the adminClient to use for making connection with the cluster
@param brokerIds all broker ids in the cluster
@param throttleBytes is the target throttle
tools/src/test/java/org/apache/kafka/tools/ToolsTestUtils.java