Replace "localhost" strings with InetAddress.getLoopbackAddress calls

This commit is contained in:
ghubstan 2020-09-14 11:53:02 -03:00
parent 304047eaca
commit 899bea8df5
No known key found for this signature in database
GPG Key ID: E35592D6800A861E
2 changed files with 9 additions and 5 deletions

View File

@ -27,6 +27,8 @@ import joptsimple.OptionParser;
import joptsimple.OptionSet;
import joptsimple.OptionSpec;
import java.net.InetAddress;
import java.nio.file.Paths;
import java.io.File;
@ -169,7 +171,7 @@ public class ApiTestConfig {
ArgumentAcceptingOptionSpec<String> bitcoinRegtestHostOpt =
parser.accepts(BITCOIN_REGTEST_HOST, "Bitcoin Core regtest host")
.withRequiredArg()
.ofType(String.class).defaultsTo("localhost");
.ofType(String.class).defaultsTo(InetAddress.getLoopbackAddress().getHostAddress());
ArgumentAcceptingOptionSpec<Integer> bitcoinRpcPortOpt =
parser.accepts(BITCOIN_RPC_PORT, "Bitcoin Core rpc port (non-default)")

View File

@ -17,6 +17,8 @@
package bisq.apitest;
import java.net.InetAddress;
import java.io.IOException;
import java.util.concurrent.ExecutionException;
@ -69,16 +71,16 @@ public class ApiTestCase {
scaffold = new Scaffold(supportingApps).setUp();
config = scaffold.config;
bitcoinCli = new BitcoinCliHelper((config));
// For now, all grpc requests are sent to the alicedaemon, but this will need to
// be made configurable for new test cases that call arb or bob node daemons.
grpcStubs = new GrpcStubs("localhost", alicedaemon.apiPort, config.apiPassword);
grpcStubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(),
alicedaemon.apiPort, config.apiPassword);
}
public static void setUpScaffold(String[] params)
throws InterruptedException, ExecutionException, IOException {
scaffold = new Scaffold(params).setUp();
config = scaffold.config;
grpcStubs = new GrpcStubs("localhost", alicedaemon.apiPort, config.apiPassword);
grpcStubs = new GrpcStubs(InetAddress.getLoopbackAddress().getHostAddress(),
alicedaemon.apiPort, config.apiPassword);
}
public static void tearDownScaffold() {