Stub a connection during testing.