@Test
  public void testStupidlyLargeSet() throws Exception {
    Random r = new Random();
    SerializingTranscoder st = new SerializingTranscoder();
    st.setCompressionThreshold(Integer.MAX_VALUE);

    byte[] data = new byte[21 * 1024 * 1024];
    r.nextBytes(data);

    try {
      client.set("bigobject", 60, data, st).get();
      fail("Didn't fail setting big object.");
    } catch (IllegalArgumentException e) {
      assertEquals(
          "Cannot cache data larger than "
              + CachedData.MAX_SIZE
              + " bytes "
              + "(you tried to cache a "
              + data.length
              + " byte object)",
          e.getMessage());
    }

    // But I should still be able to do something.
    client.set("k", 5, "Blah");
    assertEquals("Blah", client.get("k"));
  }
  @Test
  public void testStupidlyLargeSetAndSizeOverride() throws Exception {
    Random r = new Random();
    SerializingTranscoder st = new SerializingTranscoder(Integer.MAX_VALUE);

    st.setCompressionThreshold(Integer.MAX_VALUE);

    byte[] data = new byte[21 * 1024 * 1024];
    r.nextBytes(data);

    try {
      client.set("bigobject", 60, data, st).get();
      fail("Didn't fail setting big object.");
    } catch (ExecutionException e) {
      System.err.println(
          "Successful failure setting big object.  Object size "
              + data.length
              + " bytes doesn't fit.");
      e.printStackTrace();
      OperationException oe = (OperationException) e.getCause();
      assertSame(OperationErrorType.SERVER, oe.getType());
    }

    // But I should still be able to do something.
    client.set("k", 5, "Blah");
    assertEquals("Blah", client.get("k"));
  }