Object sourceGateway = source.getAnnotation(AnnotationKeys.GATEWAY);
Object targetGateway = target.getAnnotation(AnnotationKeys.GATEWAY);
String transferName = mTransferPrefix + (mDTCounter++);
// insert a new external output node with an auto-generated name
ExternalOutputNode externalOutput =
new ExternalOutputNode(transferName, mRootGateway);
RequestNodeInput newInput =
new SingleRequestNodeInput(externalOutput, ExternalOutputNode.INPUT_NAME, 0);
replaceTarget(connection, target, newInput);
externalOutput.getAllInputs().get(ExternalOutputNode.INPUT_NAME).put(0, connection);
externalOutput.addAnnotation(AnnotationKeys.GATEWAY, sourceGateway);
graph.add(externalOutput);
// insert an external input node which connects to the results
ExternalInputNode externalInput =
new ExternalInputNode(transferName, mRootGateway);