@Test
public void encode() {

    AbstractByteBuf data = serializer.encode("xxx", null);
    String dst = (String) serializer.decode(data, String.class, null);
    Assert.assertEquals("xxx", dst);
    boolean error = false;
    try {
        serializer.decode(data, "", null);
    } catch (Exception e) {
        error = true;
    }
    Assert.assertTrue(error);
    error = false;
    try {
        serializer.decode(data, null, null);
    } catch (Exception e) {
        error = true;
    }
    Assert.assertTrue(error);
    error = false;
    try {
        serializer.decode(data, (Object) null, null);
    } catch (Exception e) {
        error = true;
    }
    Assert.assertTrue(error);
}