@Override
    public void doStop() throws Exception {
        //Shutting down the connection when leaving the Context
        if (connection != null && connection.isConnected()) {
            connection.close();
            connection = null;
        }
    }
@Test
    public void doStopBadConnection() throws Exception {
        PlcConnection plcConnectionMock = mock(PlcConnection.class);
        sut.connection = plcConnectionMock;
        doThrow(new RuntimeException("oh noes")).when(plcConnectionMock).close();
        sut.doStop();
    }