factory.create(HostAndPort.fromParts("144.175.1.2", 22),
LoginCredentials.builder().user("foo").privateKey(Pems.PRIVATE_PKCS1_MARKER).build())).andReturn(client2Foo);
expect(
factory.create(HostAndPort.fromParts("144.175.1.2", 22),
LoginCredentials.builder().user("root").password("romeo").build())).andThrow(
new AuthorizationException("Auth fail", null));
// run script without backgrounding (via predicate)
client2.connect();
expect(client2.exec("hostname\n")).andReturn(new ExecResponse("stub-r\n", "", 0));
client2.disconnect();