Example usage for org.springframework.ide.eclipse.boot.dash.ngrok NGROKProcess startNGROK

List of usage examples for org.springframework.ide.eclipse.boot.dash.ngrok NGROKProcess startNGROK

Introduction

In this page you can find the example usage for org.springframework.ide.eclipse.boot.dash.ngrok NGROKProcess startNGROK.

Prototype

public static NGROKProcess startNGROK(String path, String proto, String addr) throws Exception 

Source Link

Usage

From source file:org.springframework.ide.eclipse.boot.dash.ngrok.NGROKClient.java

public NGROKTunnel startTunnel(String proto, String addr) throws Exception {
    process = NGROKProcess.startNGROK(path, proto, addr);
    if (process != null) {

        boolean success = false;
        int seconds = 0;

        while (!success && seconds < CREATE_TUNNEL_TIMEOUT_SECONDS) {
            NGROKTunnel[] tunnels = retrieveTunnels();
            if (tunnels != null && tunnels.length > 0) {
                for (int i = 0; i < tunnels.length; i++) {
                    if (tunnels[i].getAddr().endsWith(addr) && tunnels[i].getProto().equals(proto)) {
                        tunnel = tunnels[i];
                        return tunnel;
                    }/*  w  w w . j av a 2  s  .  c  om*/
                }
            }
            seconds++;
            Thread.sleep(1000);
        }
    }

    return null;
}