StringSerializer { public static byte[] encode(String s) { return s == null ? new byte[0] : s.getBytes(RpcConstants.DEFAULT_CHARSET); }  static byte[] encode(String s); static String decode(byte[] data);  }
@Test public void encode() { Assert.assertTrue(StringSerializer.encode("11").length == 2); Assert.assertTrue(StringSerializer.encode("").length == 0); Assert.assertTrue(StringSerializer.encode(null).length == 0); }