@@ -0,0 +1,1448 @@
+package com.jenjinstudios.io.connection;%0A%0Aimport com.jenjinstudios.io.ExecutionContext;%0Aimport com.jenjinstudios.io.Message;%0Aimport com.jenjinstudios.io.MessageReader;%0Aimport com.jenjinstudios.io.MessageWriter;%0Aimport org.testng.annotations.Test;%0A%0Aimport static org.mockito.Mockito.*;%0A%0A%0A/**%0A * Used to test the Connection class.%0A *%0A * @author Caleb Brinkman%0A */%0Apublic class ConnectionTest%0A%7B%0A    /**%0A     * Test starting a connection, receiving a message, writing a response, and shutting down.%0A     *%0A     * @throws Exception If there's an exception during testing.%0A     */%0A    @Test%0A    public void testRun() throws Exception %7B%0A        ExecutionContext context = mock(ExecutionContext.class);%0A        MessageReader reader = mock(MessageReader.class);%0A        MessageWriter writer = mock(MessageWriter.class);%0A        Message incoming = mock(Message.class);%0A        Message outgoing = mock(Message.class);%0A%0A        when(reader.read()).thenReturn(incoming).thenAnswer(invocation -%3E %7B%0A            Thread.sleep(1000); // Forces read method to hang%0A            return null;%0A        %7D);%0A%0A        when(incoming.execute(context)).thenReturn(outgoing);%0A%0A        Connection connection = new Connection(context, reader, writer);%0A        connection.start();%0A%0A        // Allow connection time to process message%0A        Thread.sleep(100);%0A%0A        verify(reader, atLeast(1)).read();%0A        verify(writer).write(outgoing);%0A%0A        connection.stop();%0A    %7D%0A%0A%7D

Add ConnectionTest