SshClient extends AbstractEndpoint implements Producer, ReplyConsumer { private void setKnownHosts() { if (getEndpointConfiguration().getKnownHosts() == null) { throw new CitrusRuntimeException("Strict host checking is enabled but no knownHosts given"); } try { InputStream khIs = FileUtils.getFileResource(getEndpointConfiguration().getKnownHosts()).getInputStream(); if (khIs == null) { throw new CitrusRuntimeException("Cannot find knownHosts at " + getEndpointConfiguration().getKnownHosts()); } jsch.setKnownHosts(khIs); } catch (JSchException e) { throw new CitrusRuntimeException("Cannot add known hosts from " + getEndpointConfiguration().getKnownHosts() + ": " + e,e); } catch (IOException e) { throw new CitrusRuntimeException("Cannot find known hosts file " + getEndpointConfiguration().getKnownHosts() + ": " + e,e); } } SshClient(); protected  SshClient(SshEndpointConfiguration endpointConfiguration); @Override SshEndpointConfiguration getEndpointConfiguration(); void send(Message message, TestContext context); @Override Message receive(TestContext context); @Override Message receive(String selector, TestContext context); @Override Message receive(TestContext context, long timeout); @Override Message receive(String selector, TestContext context, long timeout); @Override Producer createProducer(); @Override SelectiveConsumer createConsumer(); JSch getJsch(); void setJsch(JSch jsch); void setCorrelationManager(CorrelationManager<Message> correlationManager);  }
@Test public void strictHostCheckingWithKnownHosts() throws JSchException, IOException { strictHostChecking(true, "classpath:com/consol/citrus/ssh/knownHosts"); jsch.setKnownHosts(isA(InputStream.class)); standardChannelPrepAndSend(); }