@@ -81,18 +81,20 @@ public String getPassword() {
8181 }
8282
8383 @ Test
84- public void resp3Protocol () {
84+ public void connectOnResp3Protocol () {
8585 try (Jedis jedis = new Jedis (hnp , DefaultJedisClientConfig .builder ()
86- .protocol (RedisProtocol .RESP3 ).user ( "default" ). password ("foobared" ).build ())) {
86+ .protocol (RedisProtocol .RESP3 ).password ("foobared" ).build ())) {
8787 assertEquals ("PONG" , jedis .ping ());
88+ assertEquals (RedisProtocol .RESP3 , jedis .getConnection ().getRedisProtocol ());
8889 }
8990 }
9091
9192 @ Test
92- public void resp3Shortcut () {
93+ public void connectOnResp3ProtocolShortcut () {
9394 try (Jedis jedis = new Jedis (hnp , DefaultJedisClientConfig .builder ().resp3 ()
94- .user ( "default" ). password ("foobared" ).build ())) {
95+ .password ("foobared" ).build ())) {
9596 assertEquals ("PONG" , jedis .ping ());
97+ assertEquals (RedisProtocol .RESP3 , jedis .getConnection ().getRedisProtocol ());
9698 }
9799 }
98100
@@ -153,7 +155,7 @@ public void shouldThrowInvalidURIExceptionForInvalidURI() throws URISyntaxExcept
153155// }
154156
155157 @ Test
156- public void startWithUrl () {
158+ public void connectWithUrl () {
157159 try (Jedis j = new Jedis ("localhost" , 6380 )) {
158160 j .auth ("foobared" );
159161 j .select (2 );
@@ -167,7 +169,7 @@ public void startWithUrl() {
167169 }
168170
169171 @ Test
170- public void startWithUri () throws URISyntaxException {
172+ public void connectWithUri () throws URISyntaxException {
171173 try (Jedis j = new Jedis ("localhost" , 6380 )) {
172174 j .auth ("foobared" );
173175 j .select (2 );
@@ -180,6 +182,34 @@ public void startWithUri() throws URISyntaxException {
180182 }
181183 }
182184
185+ @ Test
186+ public void connectWithUrlOnResp3 () {
187+ try (Jedis j = new Jedis ("localhost" , 6380 )) {
188+ j .auth ("foobared" );
189+ j .select (2 );
190+ j .set ("foo" , "bar" );
191+ }
192+
193+ try (Jedis j2 = new Jedis ("redis://:foobared@localhost:6380/2?protocol=3" )) {
194+ assertEquals ("PONG" , j2 .ping ());
195+ assertEquals ("bar" , j2 .get ("foo" ));
196+ }
197+ }
198+
199+ @ Test
200+ public void connectWithUriOnResp3 () throws URISyntaxException {
201+ try (Jedis j = new Jedis ("localhost" , 6380 )) {
202+ j .auth ("foobared" );
203+ j .select (2 );
204+ j .set ("foo" , "bar" );
205+ }
206+
207+ try (Jedis jedis = new Jedis (new URI ("redis://:foobared@localhost:6380/2?protocol=3" ))) {
208+ assertEquals ("PONG" , jedis .ping ());
209+ assertEquals ("bar" , jedis .get ("foo" ));
210+ }
211+ }
212+
183213 @ Test
184214 public void shouldNotUpdateDbIndexIfSelectFails () {
185215 int currentDb = jedis .getDB ();
0 commit comments