lib/plugins/aws/invokeLocal/index.js/AwsInvokeLocal/callJavaBridge
class AwsInvokeLocal:  callJavaBridge(artifactPath, className, handlerName, input) {
    return new BbPromise((resolve, reject) =>
      fs.statAsync(artifactPath).then(
        () => {
          const java = spawn(
            'java',
            [
              `-DartifactPath=${artifactPath}`,
              `-DclassName=${className}`,
              `-DhandlerName=${handlerName}`,
              '-jar',
              path.join(__dirname, 'java', 'target', 'invoke-bridge-1.0.1.jar'),
            ],
            { shell: true }
          );

          this.serverless.cli.log(
            [
              'In order to get human-readable output,',
              ' please implement "toString()" method of your "ApiGatewayResponse" object.',
            ].join('')
          );

          java.stdout.on('data', buf => this.serverless.cli.consoleLog(buf.toString()));
          java.stderr.on('data', buf => this.serverless.cli.consoleLog(buf.toString()));
          java.on('close', () => resolve());
          let isRejected = false;
          java.on('error', error => {
            isRejected = true;
            reject(error);
          });

          process.nextTick(() => {
            if (isRejected) return; // Runtime not available
            java.stdin.write(input);
            java.stdin.end();
          });
        },
        () => {
          throw new Error(`Artifact ${artifactPath} doesn't exists, please compile it first.`);
        }
      )
    );
  }