  @Test
  public void testByteCapacityBufferChangeConfig() {

    Context context = new Context();
    Map<String, String> parms = new HashMap<String, String>();
    parms.put("byteCapacity", "2000");
    parms.put("byteCapacityBufferPercentage", "20");
    context.putAll(parms);
    Configurables.configure(channel,  context);

    byte[] eventBody = new byte[405];

    Transaction tx = channel.getTransaction();
    tx.begin();
    channel.put(EventBuilder.withBody(eventBody));

    parms.put("byteCapacity", "1500");
    context.putAll(parms);
    Configurables.configure(channel,  context);

    channel.put(EventBuilder.withBody(eventBody));
    try {
      channel.put(EventBuilder.withBody(eventBody));
      Assert.fail();
    } catch ( ChannelException e ) {
      //success
    }

    parms.put("byteCapacity", "2500");
    parms.put("byteCapacityBufferPercentage", "20");
    context.putAll(parms);
    Configurables.configure(channel,  context);

    channel.put(EventBuilder.withBody(eventBody));

    parms.put("byteCapacity", "300");
    context.putAll(parms);
    Configurables.configure(channel,  context);

    channel.put(EventBuilder.withBody(eventBody));
    try {
      channel.put(EventBuilder.withBody(eventBody));
      Assert.fail();
    } catch ( ChannelException e ) {
      //success
    }

    parms.put("byteCapacity", "3300");
    context.putAll(parms);
    Configurables.configure(channel,  context);

    channel.put(EventBuilder.withBody(eventBody));

    try {
      channel.put(EventBuilder.withBody(eventBody));
      Assert.fail();
    } catch ( ChannelException e ) {
      //success
    }

    parms.put("byteCapacity", "4000");
    context.putAll(parms);
    Configurables.configure(channel,  context);

    channel.put(EventBuilder.withBody(eventBody));

    try {
      channel.put(EventBuilder.withBody(eventBody));
      Assert.fail();
    } catch ( ChannelException e ) {
      //success
    }
  }