@@ -52,8 +52,8 @@ public class OpenSergoClient implements AutoCloseable {
5252
5353 public static class Builder {
5454
55- private String host ;
56- private int port ;
55+ private String host = "localhost" ;
56+ private int port = 10246 ;
5757 private OpenSergoClientConfig openSergoConfig ;
5858
5959 public OpenSergoClient .Builder endpoint (String host , int port ) {
@@ -83,6 +83,7 @@ public OpenSergoClient(String host, int port) {
8383 }
8484
8585 public OpenSergoClient (String host , int port , OpenSergoClientConfig clientConfig ) {
86+ checkEndpoint (host , port );
8687 checkClientConfig (clientConfig );
8788 // TODO: support TLS
8889 this .clientConfig = clientConfig ;
@@ -95,6 +96,11 @@ public OpenSergoClient(String host, int port, OpenSergoClientConfig clientConfig
9596 this .reqId = new AtomicInteger (0 );
9697 }
9798
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+
98104 private void checkClientConfig (OpenSergoClientConfig clientConfig ) {
99105 AssertUtils .assertNotNull (clientConfig , "clientConfig cannot be null" );
100106 }
0 commit comments