@@ -52,8 +52,8 @@ public class OpenSergoClient implements AutoCloseable {
52
52
53
53
public static class Builder {
54
54
55
- private String host ;
56
- private int port ;
55
+ private String host = "localhost" ;
56
+ private int port = 10246 ;
57
57
private OpenSergoClientConfig openSergoConfig ;
58
58
59
59
public OpenSergoClient .Builder endpoint (String host , int port ) {
@@ -83,6 +83,7 @@ public OpenSergoClient(String host, int port) {
83
83
}
84
84
85
85
public OpenSergoClient (String host , int port , OpenSergoClientConfig clientConfig ) {
86
+ checkEndpoint (host , port );
86
87
checkClientConfig (clientConfig );
87
88
// TODO: support TLS
88
89
this .clientConfig = clientConfig ;
@@ -95,6 +96,11 @@ public OpenSergoClient(String host, int port, OpenSergoClientConfig clientConfig
95
96
this .reqId = new AtomicInteger (0 );
96
97
}
97
98
99
+ private void checkEndpoint (String host , int port ) {
100
+ AssertUtils .notEmpty (host , "host cannot be empty, need to give a valid host" );
101
+ AssertUtils .isTrue (port > 0 , "port < 1 is invalid, need to give a valid port" );
102
+ }
103
+
98
104
private void checkClientConfig (OpenSergoClientConfig clientConfig ) {
99
105
AssertUtils .assertNotNull (clientConfig , "clientConfig cannot be null" );
100
106
}
0 commit comments