FileChannel extends BasicChannelSemantics { void close() { if(open) { open = false; log.close(); log = null; queueRemaining = null; } }  @Override void configure(Context context); @Override synchronized void start(); @Override synchronized void stop();  }
@Test public void testCapacity() throws Exception { channel.close(); channel = createFileChannel(5); try { putEvents(channel, "capacity", 1, 6); } catch (ChannelException e) { Assert.assertEquals("Cannot acquire capacity", e.getMessage()); } Transaction transaction; transaction = channel.getTransaction(); transaction.begin(); Event event = channel.take(); Assert.assertNotNull(event); transaction.rollback(); transaction.close(); try { putEvents(channel, "capacity", 1, 1); } catch (ChannelException e) { Assert.assertEquals("Cannot acquire capacity", e.getMessage()); } Assert.assertEquals(5, takeEvents(channel, 1, 5).size()); }