@@ -0,0 +1,1785 @@
+package org.komamitsu.fluency.sender;%0A%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0Aimport java.nio.ByteBuffer;%0Aimport java.util.List;%0Aimport java.util.concurrent.atomic.AtomicBoolean;%0A%0Aimport static org.hamcrest.Matchers.is;%0Aimport static org.junit.Assert.*;%0A%0Apublic class ConfigTest%0A%7B%0A    static class DummySender%0A        extends Sender%0A    %7B%0A        private final boolean shouldFail;%0A%0A        protected DummySender(Config config, boolean shouldFail)%0A        %7B%0A            super(config);%0A            this.shouldFail = shouldFail;%0A        %7D%0A%0A        @Override%0A        public boolean isAvailable()%0A        %7B%0A            return true;%0A        %7D%0A%0A        @Override%0A        protected void sendInternal(List%3CByteBuffer%3E dataList, byte%5B%5D ackToken)%0A                throws IOException%0A        %7B%0A            if (shouldFail) %7B%0A                throw new RuntimeException(%22Unexpected scheduled error occurred%22);%0A            %7D%0A        %7D%0A%0A        @Override%0A        public void close()%0A                throws IOException%0A        %7B%0A        %7D%0A    %7D%0A%0A    @Test%0A    public void errorHandler()%0A            throws IOException%0A    %7B%0A        final AtomicBoolean errorOccurred = new AtomicBoolean();%0A        Sender.Config config = new Sender.Config().setErrorHandler(new Sender.ErrorHandler()%0A        %7B%0A            @Override%0A            public void handle(Throwable e)%0A            %7B%0A                errorOccurred.set(true);%0A            %7D%0A        %7D);%0A%0A        new DummySender(config, false).send(ByteBuffer.allocate(8));%0A        assertThat(errorOccurred.get(), is(false));%0A%0A        try %7B%0A            new DummySender(config, true).send(ByteBuffer.allocate(8));%0A            assertTrue(false);%0A        %7D%0A        catch (Exception e) %7B%0A            assertThat(errorOccurred.get(), is(true));%0A        %7D%0A    %7D%0A%7D

Add ConfigTest to test custom error handler