Program: 35976
Project: 35976
Buggy source:
@Test public void testFileTransfer() throws Exception {
  IContext c=Core.createSystemContext();
  try {
    new MicroflowService("String_Node_Str","String_Node_Str",HttpMethod.POST,"String_Node_Str");
    String url=RestServices.getAbsoluteUrl("String_Node_Str");
    TestFile source=new TestFile(c);
    source.setMultiplier(2);
    StringUtils.stringToFile(c,"String_Node_Str",source);
    source.commit();
    TestFile destination=new TestFile(c);
    RestConsumer.request(c,HttpMethod.POST,url,source.getMendixObject(),destination.getMendixObject(),true);
    Assert.assertEquals("String_Node_Str",StringUtils.stringFromFile(c,destination));
    RestConsumer.request(c,HttpMethod.POST,Utils.appendParamToUrl(url,TestFile.MemberNames.Multiplier.toString(),"String_Node_Str"),source.getMendixObject(),destination.getMendixObject(),true);
    Assert.assertEquals("String_Node_Str",StringUtils.stringFromFile(c,destination));
    URL u=new URL(Utils.appendParamToUrl(url,TestFile.MemberNames.Multiplier.toString(),"String_Node_Str"));
    HttpURLConnection con=(HttpURLConnection)u.openConnection();
    con.setDoOutput(true);
    con.setDoInput(true);
    con.setRequestMethod("String_Node_Str");
    con.setRequestProperty("String_Node_Str","String_Node_Str");
    con.setRequestProperty("String_Node_Str",RestServices.CONTENTTYPE_OCTET);
    con.connect();
    OutputStream out=con.getOutputStream();
    IOUtils.copy(IOUtils.toInputStream("String_Node_Str"),out);
    out.flush();
    out.close();
    InputStream in=con.getInputStream();
    List<String> lines=IOUtils.readLines(in);
    in.close();
    con.disconnect();
    Assert.assertEquals(1,lines.size());
    Assert.assertEquals("String_Node_Str",lines.get(0));
  }
  finally {
    XPath.create(c,TestFile.class).deleteAll();
  }
}

Fixed version (ground truth):
@Test public void testFileTransfer() throws Exception {
  final IContext c=Core.createSystemContext();
  Utils.withSessionCache(c,new Function<Boolean>(){
    @Override public Boolean apply() throws Exception {
      try {
        new MicroflowService("String_Node_Str","String_Node_Str",HttpMethod.POST,"String_Node_Str");
        String url=RestServices.getAbsoluteUrl("String_Node_Str");
        TestFile source=new TestFile(c);
        source.setName("String_Node_Str");
        source.setMultiplier(2);
        StringUtils.stringToFile(c,"String_Node_Str",source);
        source.commit();
        TestFile destination=new TestFile(c);
        TestFile destination2=new TestFile(c);
        RestConsumer.request(c,HttpMethod.POST,url,source.getMendixObject(),destination.getMendixObject(),true);
        Assert.assertEquals("String_Node_Str",StringUtils.stringFromFile(c,destination));
        RestConsumer.request(c,HttpMethod.POST,Utils.appendParamToUrl(url,TestFile.MemberNames.Multiplier.toString(),"String_Node_Str"),source.getMendixObject(),destination2.getMendixObject(),true);
        Assert.assertEquals("String_Node_Str",StringUtils.stringFromFile(c,destination2));
        URL u=new URL(Utils.appendParamToUrl(url,TestFile.MemberNames.Multiplier.toString(),"String_Node_Str"));
        HttpURLConnection con=(HttpURLConnection)u.openConnection();
        con.setDoOutput(true);
        con.setDoInput(true);
        con.setRequestMethod("String_Node_Str");
        con.setRequestProperty("String_Node_Str","String_Node_Str");
        con.setRequestProperty("String_Node_Str",RestServices.CONTENTTYPE_OCTET);
        con.connect();
        OutputStream out=con.getOutputStream();
        IOUtils.copy(IOUtils.toInputStream("String_Node_Str"),out);
        out.flush();
        out.close();
        InputStream in=con.getInputStream();
        List<String> lines=IOUtils.readLines(in);
        in.close();
        con.disconnect();
        Assert.assertEquals(1,lines.size());
        Assert.assertEquals("String_Node_Str",lines.get(0));
      }
  finally {
        XPath.create(c,TestFile.class).deleteAll();
      }
      return true;
    }
  }
);
}