public JedisFactory(final URI uri, final int connectionTimeout, final int soTimeout, final String clientName, final boolean ssl, final SSLSocketFactory sslSocketFactory, final SSLParameters sslParameters, final HostnameVerifier hostnameVerifier) { if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException( String.format("Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.hostAndPort.set(new HostAndPort(uri.getHost(), uri.getPort())); this.connectionTimeout = connectionTimeout; this.soTimeout = soTimeout; this.password = JedisURIHelper.getPassword(uri); this.database = JedisURIHelper.getDBIndex(uri); this.clientName = clientName; this.ssl = ssl; this.sslSocketFactory = sslSocketFactory; this.sslParameters = sslParameters; this.hostnameVerifier = hostnameVerifier; }
public JedisShardInfo(URI uri, SSLSocketFactory sslSocketFactory, SSLParameters sslParameters, HostnameVerifier hostnameVerifier) { super(Sharded.DEFAULT_WEIGHT); if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException( String.format("Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.host = uri.getHost(); this.port = uri.getPort(); this.password = JedisURIHelper.getPassword(uri); this.db = JedisURIHelper.getDBIndex(uri); this.ssl = uri.getScheme().equals("rediss"); this.sslSocketFactory = sslSocketFactory; this.sslParameters = sslParameters; this.hostnameVerifier = hostnameVerifier; }
private void initializeClientFromURI(URI uri) { if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException(String.format( "Cannot open Redis connection due invalid URI. %s", uri.toString())); } client = new Client(uri.getHost(), uri.getPort()); String password = JedisURIHelper.getPassword(uri); if (password != null) { client.auth(password); client.getStatusCodeReply(); } int dbIndex = JedisURIHelper.getDBIndex(uri); if (dbIndex > 0) { client.select(dbIndex); client.getStatusCodeReply(); client.setDb(dbIndex); } }
public JaRedisFactory(final URI uri, final int connectionTimeout, final int soTimeout, final String clientName) { if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException(String.format( "Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.hostAndPort.set(new HostAndPort(uri.getHost(), uri.getPort())); this.connectionTimeout = connectionTimeout; this.soTimeout = soTimeout; this.password = JedisURIHelper.getPassword(uri); this.database = JedisURIHelper.getDBIndex(uri); this.clientName = clientName; }
public JedisShardInfo(URI uri) { super(Sharded.DEFAULT_WEIGHT); if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException( String.format("Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.host = uri.getHost(); this.port = uri.getPort(); this.password = JedisURIHelper.getPassword(uri); this.db = JedisURIHelper.getDBIndex(uri); this.ssl = uri.getScheme().equals("rediss"); }
public JedisFactory(final URI uri, final int connectionTimeout, final int soTimeout, final String clientName) { if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException(String.format( "Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.hostAndPort.set(new HostAndPort(uri.getHost(), uri.getPort())); this.connectionTimeout = connectionTimeout; this.soTimeout = soTimeout; this.password = JedisURIHelper.getPassword(uri); this.database = JedisURIHelper.getDBIndex(uri); this.clientName = clientName; }
public JedisShardInfo(URI uri) { super(Sharded.DEFAULT_WEIGHT); if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException(String.format( "Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.host = uri.getHost(); this.port = uri.getPort(); this.password = JedisURIHelper.getPassword(uri); this.db = JedisURIHelper.getDBIndex(uri); }
public JedisFactory(final URI uri, final int connectionTimeout, final String clientName) { if (!JedisURIHelper.isValid(uri)) { throw new InvalidURIException( String.format("Cannot open Redis connection due invalid URI. %s", uri.toString())); } this.hostAndPort.set(new HostAndPort(uri.getHost(), uri.getPort())); this.connectionTimeout = connectionTimeout; this.password = JedisURIHelper.getPassword(uri); this.database = JedisURIHelper.getDBIndex(uri); this.clientName = clientName; }
@Test(expected = InvalidURIException.class) public void shouldThrowInvalidURIExceptionForInvalidURI() throws URISyntaxException { JedisPool pool = new JedisPool(new URI("localhost:6380")); }
@Test(expected = InvalidURIException.class) public void shouldThrowInvalidURIExceptionForInvalidURI() throws URISyntaxException { Jedis j = new Jedis(new URI("localhost:6380")); j.ping(); }