File pubKeyFile = createPubKeyForPort(port);
JschSftpProtocol sftpProtocol = spy(new JschSftpProtocol(port));
Mockito.doAnswer(new Answer() {
public Object answer(InvocationOnMock invocation) {
return null;
}}).when(sftpProtocol).connect("localhost", new HostKeyAuthentication("bfoster", "",
pubKeyFile.getAbsoluteFile().getAbsolutePath()));
sftpProtocol.connect("localhost", new HostKeyAuthentication("bfoster", "",
pubKeyFile.getAbsoluteFile().getAbsolutePath()));
ProtocolFile homeDir = sftpProtocol.pwd();
ProtocolFile testDir = new ProtocolFile(homeDir, "sshTestDir", true);
sftpProtocol.cd(testDir);