{"action":"opened","issue":{"url":"https://api.github.com/repos/vert-x3/vertx-redis-client/issues/46","labels_url":"https://api.github.com/repos/vert-x3/vertx-redis-client/issues/46/labels{/name}","comments_url":"https://api.github.com/repos/vert-x3/vertx-redis-client/issues/46/comments","events_url":"https://api.github.com/repos/vert-x3/vertx-redis-client/issues/46/events","html_url":"https://github.com/vert-x3/vertx-redis-client/issues/46","id":116411992,"number":46,"title":"Selecting Database works for writing a value but not getting it back.","user":{"login":"PatrickSauts","id":1509382,"avatar_url":"https://avatars.githubusercontent.com/u/1509382?v=3","gravatar_id":"","url":"https://api.github.com/users/PatrickSauts","html_url":"https://github.com/PatrickSauts","followers_url":"https://api.github.com/users/PatrickSauts/followers","following_url":"https://api.github.com/users/PatrickSauts/following{/other_user}","gists_url":"https://api.github.com/users/PatrickSauts/gists{/gist_id}","starred_url":"https://api.github.com/users/PatrickSauts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PatrickSauts/subscriptions","organizations_url":"https://api.github.com/users/PatrickSauts/orgs","repos_url":"https://api.github.com/users/PatrickSauts/repos","events_url":"https://api.github.com/users/PatrickSauts/events{/privacy}","received_events_url":"https://api.github.com/users/PatrickSauts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-11-11T20:09:47Z","updated_at":"2015-11-11T20:09:47Z","closed_at":null,"body":"When So I wrote this test\r\n\r\nAccording to the documentation selecting a database using select changes it for the current connection\r\n\r\n```\r\n  /**\r\n   * Change the selected database for the current connection\r\n   *\r\n   * @param dbindex Index identifying the new active database\r\n   * @param handler Handler for the result of this call.\r\n   * @since 1.0.0\r\n   * group: connection\r\n   */\r\n  @Fluent\r\n  RedisClient select(int dbindex, Handler<AsyncResult<String>> handler);\r\n```\r\n\r\nBut, when writing then reading, the value is not retrieved.\r\nIt works fine if I comment out the ```redis.select``` part. \r\n\r\n\r\n```\r\nimport io.vertx.core.AsyncResult;\r\nimport io.vertx.core.Handler;\r\nimport io.vertx.core.Vertx;\r\nimport io.vertx.ext.unit.TestContext;\r\nimport io.vertx.ext.unit.junit.RunTestOnContext;\r\nimport io.vertx.ext.unit.junit.VertxUnitRunner;\r\nimport io.vertx.redis.RedisClient;\r\nimport io.vertx.redis.RedisOptions;\r\n\r\nimport java.io.IOException;\r\n\r\nimport org.junit.AfterClass;\r\nimport org.junit.BeforeClass;\r\nimport org.junit.ClassRule;\r\nimport org.junit.Test;\r\nimport org.junit.runner.RunWith;\r\nimport org.slf4j.Logger;\r\nimport org.slf4j.LoggerFactory;\r\n\r\n@RunWith(VertxUnitRunner.class)\r\npublic class RedisClientTest {\r\n  private static final Logger LOG = LoggerFactory.getLogger(RedisClientTest.class);\r\n\r\n  @ClassRule\r\n  public static RunTestOnContext contextRule = new RunTestOnContext();\r\n  private static RedisClient redis;\r\n\r\n  private final static String KEY1 = \"TheFirstKey\";\r\n  private static final int DB_NUM = 1;\r\n\r\n  @BeforeClass\r\n  public static void initializeRedis(TestContext context) throws InterruptedException, IOException {\r\n    // Create the RMQ service and confirm that the connection was created\r\n    Vertx vertx = contextRule.vertx();\r\n    RedisOptions config = new RedisOptions().setHost(\"127.0.0.1\").setTcpKeepAlive(true);\r\n    redis = RedisClient.create(vertx, config);\r\n    redis.select(DB_NUM, new Handler<AsyncResult<String>>() {\r\n      @Override\r\n      public void handle(AsyncResult<String> event) {\r\n        LOG.info(event.result());\r\n        if (event.succeeded())\r\n          LOG.info(\"Redis switched to DB: {}\",DB_NUM );\r\n        if (event.failed()) {\r\n          LOG.error(\"Failed to select DB\");\r\n          throw new RuntimeException(\"Failed to select DB\");\r\n        }\r\n      }\r\n    });\r\n\r\n  }\r\n\r\n  @AfterClass\r\n  public static void stopRedis(TestContext context) throws InterruptedException, IOException {\r\n    redis.del(KEY1, r -> {\r\n        redis.close(event -> {\r\n          if (event.succeeded())\r\n            LOG.info(\"Redis connection closed\");\r\n          if (event.failed()) {\r\n            LOG.error(\"Failed to close connection to Redis\");\r\n            throw new RuntimeException(\"Failed to close connection to Redis\");\r\n          }\r\n        });\r\n      });\r\n  }\r\n\r\n  @Test\r\n  public void test(TestContext context) throws Throwable {\r\n    String message = \"this is a test\";\r\n\r\n    // Write and read a message to/from Redis\r\n    redis.set(KEY1, message, r -> {\r\n      if (r.succeeded()) {\r\n        LOG.info(\"{} wrote to Redis with value: {}\",KEY1, message);\r\n        redis.get(KEY1, r2 -> {\r\n          if (r2.failed())\r\n            LOG.error(\"Read failed \", r2.cause());\r\n          else{\r\n            LOG.info(\"{} got from Redis with value: {}\",KEY1, r2.result());\r\n            context.assertEquals(message, r2.result());\r\n          }\r\n        });\r\n      }\r\n    });\r\n  }\r\n\r\n}\r\n```\r\n\r\nAm I doing something wrong ?\r\n\r\n"}}