@@ -0,0 +1,1852 @@
+/*%0A * Copyright 2016 Ross Nicoll.%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0Apackage org.libdohj.cate;%0A%0Aimport org.bitcoinj.core.Context;%0Aimport org.bitcoinj.params.TestNet3Params;%0Aimport org.libdohj.params.DogecoinTestNet3Params;%0A%0Aimport static org.junit.Assert.assertEquals;%0Aimport org.junit.Test;%0A%0A/**%0A * Unit test for NetworkThreadFactory%0A * @author Ross Nicoll%0A */%0Apublic class NetworkThreadFactoryTest %7B%0A    /**%0A     * Generate a thread and confirm the context is set on it.%0A     */%0A    @Test%0A    public void shouldSetContextOnThread() throws InterruptedException %7B%0A        final Context expected = new Context(TestNet3Params.get());%0A        final Context broken = new Context(DogecoinTestNet3Params.get());%0A        final NetworkThreadFactory factory = new NetworkThreadFactory(expected);%0A%0A        // Progagate the wrong context onto this thread%0A        Context.propagate(broken);%0A        assertEquals(broken, Context.get());%0A%0A        final ThreadMonitor monitor = new ThreadMonitor();%0A        final Thread thread = factory.newThread(monitor);%0A        thread.run();%0A        thread.join();%0A        %0A        assertEquals(expected, monitor.actual);%0A    %7D%0A%0A    public static class ThreadMonitor implements Runnable %7B%0A        Context actual = null;%0A        public void run() %7B%0A            actual = Context.get();%0A        %7D%0A    %7D%0A%7D%0A

Add unit test for NetworkThreadFactory