title: Sprint Integration flow testing with mocked SFTP server?
body: <p>I have found a mock SFTP server implementation to be used as @Rule injection within
  JUnit tests. This lets you install a mock SFTP server. For that simply a dependency has to be added to the projects pom.xml with test scope:</p>
  <pre><code>        &lt;dependency&gt;
              &lt;groupId&gt;com.github.stefanbirkner&lt;/groupId&gt;
              &lt;artifactId&gt;fake-sftp-server-rule&lt;/artifactId&gt;
              &lt;version&gt;2.0.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
  </code></pre>
  <p>My integration flow so far is (all the parameters are injected with the @ConfigurationProperties annotation):</p>
  <pre><code>@Bean
  public SessionFactory&lt;LsEntry&gt; sftpTest1SessionFactory() {
      DefaultSftpSessionFactory sf = new DefaultSftpSessionFactory();
      sf.setHost(hostname);
      sf.setPort(port);
      sf.setUser(username);
      sf.setPassword(password);
      return new CachingSessionFactory&lt;LsEntry&gt;(sf);
  }
  
  @Bean
  public FireOnceTrigger fireOnceTrigger() {
      return new FireOnceTrigger();
  }
  
  @Bean
  public IntegrationFlow test1SftpInboundFlow() {
      return IntegrationFlows
          .from(Sftp.inboundAdapter(sftpTest1SessionFactory)
                  .preserveTimestamp(true)
                  .remoteDirectory(remoteDir)
                  .regexFilter(remoteFilePattern)
                  .localFilenameExpression(localFile)
                  .localDirectory(new File(localDir)),
               e -&gt; e.id(&quot;sftpTest1InboundAdapter&quot;)
                  .autoStartup(true)
                  .poller(Pollers.trigger(fireOnceTrigger()))
               )
          .transform(e -&gt; e)
          .handle(m -&gt; System.out.println(m.getPayload()))
          .get();
  }
  </code></pre>
  <p>Is it possible to combine my integration flow in a test case with this mocked SFTP server? How would I do this?</p>