Skip to content

Commit 4837a30

Browse files
committed
localhost uri utils
1 parent 0c93e44 commit 4837a30

File tree

3 files changed

+24
-3
lines changed

3 files changed

+24
-3
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ plugins {
88
id 'signing'
99
}
1010

11-
def jarVersion = "1.0.13"
11+
def jarVersion = "1.0.14"
1212
group = 'io.nats'
1313

1414
def isMerge = System.getenv("BUILD_EVENT") == "push"

src/main/java/nats/io/NatsRunnerUtils.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,30 @@ public class NatsRunnerUtils {
3939
* Build a standard nats://localhost:port uri
4040
* @param port the port
4141
* @return the uri
42+
* @deprecated Use {@link #getNatsLocalhostUri(int)} instead.
4243
*/
44+
@Deprecated
4345
public static String getURIForPort(int port) {
44-
return "nats://localhost:" + port;
46+
return getLocalhostUri("nats", port);
47+
}
48+
49+
/**
50+
* Build a nats://localhost:port uri
51+
* @param port the port
52+
* @return the uri
53+
*/
54+
public static String getNatsLocalhostUri(int port) {
55+
return getLocalhostUri("nats", port);
56+
}
57+
58+
/**
59+
* Build a schema://localhost:port uri
60+
* @param schema the schema
61+
* @param port the port
62+
* @return the uri
63+
*/
64+
public static String getLocalhostUri(String schema, int port) {
65+
return schema + "://localhost:" + port;
4566
}
4667

4768
/**

src/main/java/nats/io/NatsServerRunner.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ public String getConfigFile() {
434434
* @return the uri string
435435
*/
436436
public String getURI() {
437-
return getURIForPort(_port);
437+
return getNatsLocalhostUri(_port);
438438
}
439439

440440
/**

0 commit comments

Comments
 (0)