private void processWithMarianServer(String serverURI, File sourceFile, File targetFile)
            throws TikaException {
        try {
            MarianServerClient clientEndpoint =
                    new MarianServerClient(new URI(serverURI), targetFile);
            clientEndpoint.translate(
                    FileUtils.readFileToString(sourceFile, Charset.defaultCharset()));
            long start = System.currentTimeMillis();
            long elapsed = System.currentTimeMillis() - start;
            while (!clientEndpoint.receivedResponse && elapsed < maxWaitForMarianServerResponse) {
                try {
                    Thread.sleep(pulseCheckMarianServerResponse);
                } catch (InterruptedException e) {
                    // Swallow
                }
                elapsed = System.currentTimeMillis() - start;
            }
            clientEndpoint.close();
        } catch (IOException | URISyntaxException e) {
            throw new TikaException("Failed perform translation", e);
        }
    }
Process the translation request using a Marian-Server instance. Marian Server is Marian NMT's WebSocket
based server application (<i>marian-server</i>.

@param serverURI  the Web Socket URI of the Marian Server instance.
@param sourceFile the file containing the source text to read from.
@param targetFile the file to write the translated text to.
@throws TikaException on any error translating via the server.
tika-translate/src/main/java/org/apache/tika/language/translate/impl/MarianTranslator.java