/** * Start a server on the specified host and port. * Note that this method is blocking. */ public void startServer(String host, int port) throws ExecutionException, InterruptedException { startServer(host, port, ServerSettings.create(ConfigFactory.load())); }
private HttpClientFacade(final ActorSystem actorSystem, final boolean proxyEnabled, final String proxyHost, final Integer proxyPort, final String proxyUsername, final String proxyPassword) { this.actorSystem = actorSystem; if (proxyEnabled) { final ClientTransport proxyClientTransport; if (proxyHost != null && proxyPort != null && proxyUsername != null && proxyPassword != null) { proxyClientTransport = ClientTransport.httpsProxy( InetSocketAddress.createUnresolved(proxyHost, proxyPort), HttpCredentials.create(proxyUsername, proxyPassword) ); } else if (proxyHost != null && proxyPort != null) { proxyClientTransport = ClientTransport.httpsProxy( InetSocketAddress.createUnresolved(proxyHost, proxyPort) ); } else { throw new IllegalArgumentException("When HTTP proxy is enabled via config '" + ConfigKeys.AUTHENTICATION_HTTP_PROXY_ENABLED + "' at least proxy host and port must be configured as well"); } connectionPoolSettings = ConnectionPoolSettings.create(actorSystem).withTransport(proxyClientTransport); } else { connectionPoolSettings = ConnectionPoolSettings.create(actorSystem); } actorMaterializer = ActorMaterializer.create(actorSystem); }
/** * Start a server on the specified host and port, using the provided [[ActorSystem]] * Note that this method is blocking. * * @param system ActorSystem to use for starting the app, * if null is passed in a new default ActorSystem will be created instead, which will * be terminated when the server is stopped. */ public void startServer(String host, int port, ActorSystem system) throws ExecutionException, InterruptedException { startServer(host, port, ServerSettings.create(system), Optional.ofNullable(system)); }
private HttpClientFacade(final ActorSystem actorSystem, final boolean proxyEnabled, final String proxyHost, final Integer proxyPort, final String proxyUsername, final String proxyPassword) { this.actorSystem = actorSystem; if (proxyEnabled) { final ClientTransport proxyClientTransport; if (proxyHost != null && proxyPort != null && proxyUsername != null && proxyPassword != null) { proxyClientTransport = ClientTransport.httpsProxy( InetSocketAddress.createUnresolved(proxyHost, proxyPort), HttpCredentials.create(proxyUsername, proxyPassword) ); } else if (proxyHost != null && proxyPort != null) { proxyClientTransport = ClientTransport.httpsProxy( InetSocketAddress.createUnresolved(proxyHost, proxyPort) ); } else { throw new IllegalArgumentException("When HTTP proxy is enabled via config '" + ConfigKeys.AUTHENTICATION_HTTP_PROXY_ENABLED + "' at least proxy host and port must be configured as well"); } connectionPoolSettings = ConnectionPoolSettings.create(actorSystem).withTransport(proxyClientTransport); } else { connectionPoolSettings = ConnectionPoolSettings.create(actorSystem); } actorMaterializer = ActorMaterializer.create(actorSystem); }
/** * Start a server on the specified host and port. * Note that this method is blocking. */ public void startServer(String host, int port) throws ExecutionException, InterruptedException { startServer(host, port, ServerSettings.create(ConfigFactory.load())); }
/** * Start a server on the specified host and port, using the provided [[ActorSystem]] * Note that this method is blocking. * * @param system ActorSystem to use for starting the app, * if null is passed in a new default ActorSystem will be created instead, which will * be terminated when the server is stopped. */ public void startServer(String host, int port, ActorSystem system) throws ExecutionException, InterruptedException { startServer(host, port, ServerSettings.create(system), Optional.ofNullable(system)); }
/** * Start a server on the specified host and port. * Note that this method is blocking. */ public void startServer(String host, int port) throws ExecutionException, InterruptedException { startServer(host, port, ServerSettings.create(ConfigFactory.load())); }
/** * Start a server on the specified host and port, using the provided [[ActorSystem]] * Note that this method is blocking. * * @param system ActorSystem to use for starting the app, * if null is passed in a new default ActorSystem will be created instead, which will * be terminated when the server is stopped. */ public void startServer(String host, int port, ActorSystem system) throws ExecutionException, InterruptedException { startServer(host, port, ServerSettings.create(system), Optional.ofNullable(system)); }