TestEchoShellFactory shellFactory = new TestEchoShellFactory();
ProxyAgentFactory agentFactory = new ProxyAgentFactory();
LocalAgentFactory localAgentFactory = new LocalAgentFactory();
KeyPair pair = new FileKeyPairProvider(new String[] { "src/test/resources/dsaprivkey.pem" }).loadKey(KeyPairProvider.SSH_DSS);
localAgentFactory.getAgent().addIdentity(pair, "smx");
SshServer sshd1 = SshServer.setUpDefaultServer();
sshd1.setPort(port1);
sshd1.setKeyPairProvider(new FileKeyPairProvider(new String[]{"src/test/resources/hostkey.pem"}));
sshd1.setShellFactory(shellFactory);
sshd1.setPasswordAuthenticator(new BogusPasswordAuthenticator());
sshd1.setPublickeyAuthenticator(new BogusPublickeyAuthenticator());
sshd1.setAgentFactory(agentFactory);
sshd1.start();
SshServer sshd2 = SshServer.setUpDefaultServer();
sshd2.setPort(port2);
sshd2.setKeyPairProvider(new FileKeyPairProvider(new String[]{"src/test/resources/hostkey.pem"}));
sshd2.setShellFactory(new TestEchoShellFactory());
sshd2.setPasswordAuthenticator(new BogusPasswordAuthenticator());
sshd2.setPublickeyAuthenticator(new BogusPublickeyAuthenticator());
sshd2.setAgentFactory(new ProxyAgentFactory());
sshd2.start();