@@ -159,6 +159,8 @@ public static class Builder {
159159 * @param password
160160 */
161161 public Builder withCredentials (ByteString name , ByteString password ) {
162+ Preconditions .checkArgument ((name == null ) == (password == null ),
163+ "name and password must both be null or both be non-null" );
162164 this .name = name ;
163165 this .password = password ;
164166 return this ;
@@ -189,6 +191,7 @@ public Builder withImmediateAuth() {
189191 * subject to change - threads to use for <b>internal</b> executor
190192 */
191193 public Builder withThreadCount (int threads ) {
194+ Preconditions .checkArgument (threads > 0 , "invalid thread count: %s" , threads );
192195 this .threads = threads ;
193196 return this ;
194197 }
@@ -251,7 +254,7 @@ public Builder withPlainText() {
251254 * to all endpoints and does not otherwise affect DNS name resolution.
252255 */
253256 public Builder overrideAuthority (String authority ) {
254- this .overrideAuthority = authority ;
257+ this .overrideAuthority = Preconditions . checkNotNull ( authority , "authority" ) ;
255258 return this ;
256259 }
257260
@@ -303,7 +306,7 @@ public Builder withTlsConfig(Consumer<SslContextBuilder> contextBuilder) throws
303306 * @param timeoutSecs
304307 */
305308 public Builder withSessionTimeoutSecs (int timeoutSecs ) {
306- Preconditions .checkArgument (timeoutSecs < 1 , "invalid session timeout: %s" , timeoutSecs );
309+ Preconditions .checkArgument (timeoutSecs > 0 , "invalid session timeout: %s" , timeoutSecs );
307310 this .sessTimeoutSecs = timeoutSecs ;
308311 return this ;
309312 }
0 commit comments