com.alipay.remoting.exception.SerializationException Java Examples

The following examples show how to use com.alipay.remoting.exception.SerializationException. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProtobufSerializer.java    From sofa-jraft with Apache License 2.0 6 votes vote down vote up
@Override
public <T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
                                                                                                 throws SerializationException {

    final RpcRequestCommand cmd = (RpcRequestCommand) request;
    final Message msg = (Message) cmd.getRequestObject();
    if (msg instanceof RpcRequests.AppendEntriesRequest) {
        final RpcRequests.AppendEntriesRequest req = (RpcRequests.AppendEntriesRequest) msg;
        final RpcRequests.AppendEntriesRequestHeader.Builder hb = RpcRequests.AppendEntriesRequestHeader
            .newBuilder() //
            .setGroupId(req.getGroupId()) //
            .setPeerId(req.getPeerId()) //
            .setServerId(req.getServerId());
        cmd.setHeader(hb.build().toByteArray());
        return true;
    }

    return false;
}
 
Example #2
Source File: ClassCustomSerializerTest.java    From sofa-bolt with Apache License 2.0 6 votes vote down vote up
/**
 * test SerializationException when serial request
 * @throws Exception
 */
@Test
public void testRequestSerialException() throws Exception {
    ExceptionRequestBodyCustomSerializer s1 = new ExceptionRequestBodyCustomSerializer(true,
        false, false, false);
    NormalStringCustomSerializer s2 = new NormalStringCustomSerializer();
    CustomSerializerManager.registerCustomSerializer(RequestBody.class.getName(), s1);
    CustomSerializerManager.registerCustomSerializer(String.class.getName(), s2);

    RequestBody body = new RequestBody(1, "hello world!");
    String ret = null;
    try {
        ret = (String) client.invokeSync(addr, body, 1000);
        Assert.fail("Should not reach here!");
    } catch (SerializationException e) {
        logger.error("", e);
        Assert.assertFalse(e.isServerSide());
        Assert.assertEquals(null, ret);
        Assert.assertTrue(s1.isSerialized());
        Assert.assertFalse(s1.isDeserialized());
        Assert.assertFalse(s2.isSerialized());
        Assert.assertFalse(s2.isDeserialized());
    } catch (Throwable t) {
        Assert.fail("Should not reach here!");
    }
}
 
Example #3
Source File: NormalRequestBodyCustomSerializer.java    From sofa-bolt with Apache License 2.0 6 votes vote down vote up
/** 
 * @see CustomSerializer#serializeContent(RequestCommand, InvokeContext)
 */
@Override
public <T extends RequestCommand> boolean serializeContent(T req, InvokeContext invokeContext)
                                                                                              throws SerializationException {
    serialFlag.set(true);
    RpcRequestCommand rpcReq = (RpcRequestCommand) req;
    RequestBody bd = (RequestBody) rpcReq.getRequestObject();
    int id = bd.getId();
    byte[] msg;
    try {
        msg = bd.getMsg().getBytes("UTF-8");
        ByteBuffer bb = ByteBuffer.allocate(4 + msg.length);
        bb.putInt(id);
        bb.put(msg);
        rpcReq.setContent(bb.array());
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    contentSerializer = rpcReq.getSerializer();
    return true;
}
 
Example #4
Source File: ClassCustomSerializerTest.java    From sofa-bolt with Apache License 2.0 6 votes vote down vote up
/**
 * test RuntimeException when serial request
 * @throws Exception
 */
@Test
public void testRequestSerialRuntimeException() throws Exception {
    ExceptionRequestBodyCustomSerializer s1 = new ExceptionRequestBodyCustomSerializer(false,
        true, false, false);
    NormalStringCustomSerializer s2 = new NormalStringCustomSerializer();
    CustomSerializerManager.registerCustomSerializer(RequestBody.class.getName(), s1);
    CustomSerializerManager.registerCustomSerializer(String.class.getName(), s2);

    RequestBody body = new RequestBody(1, "hello world!");
    String ret = null;
    try {
        ret = (String) client.invokeSync(addr, body, 1000);
        Assert.fail("Should not reach here!");
    } catch (SerializationException e) {
        logger.error("", e);
        Assert.assertFalse(e.isServerSide());
        Assert.assertEquals(null, ret);
        Assert.assertTrue(s1.isSerialized());
        Assert.assertFalse(s1.isDeserialized());
        Assert.assertFalse(s2.isSerialized());
        Assert.assertFalse(s2.isDeserialized());
    } catch (Throwable t) {
        Assert.fail("Should not reach here!");
    }
}
 
Example #5
Source File: ClassCustomSerializerTest.java    From sofa-bolt with Apache License 2.0 6 votes vote down vote up
/**
 * test SerializationException when serial response
 * @throws Exception
 */
@Test
public void testResponseSerialException() throws Exception {
    NormalRequestBodyCustomSerializer s1 = new NormalRequestBodyCustomSerializer();
    ExceptionStringCustomSerializer s2 = new ExceptionStringCustomSerializer(true, false,
        false, false);
    CustomSerializerManager.registerCustomSerializer(RequestBody.class.getName(), s1);
    CustomSerializerManager.registerCustomSerializer(String.class.getName(), s2);

    RequestBody body = new RequestBody(1, "hello world!");
    String ret = null;
    try {
        ret = (String) client.invokeSync(addr, body, 1000);
        Assert.fail("Should not reach here!");
    } catch (SerializationException e) {
        logger.error("", e);
        Assert.assertTrue(e.isServerSide());
        Assert.assertEquals(null, ret);
        Assert.assertTrue(s1.isSerialized());
        Assert.assertTrue(s1.isDeserialized());
        Assert.assertTrue(s2.isSerialized());
        Assert.assertFalse(s2.isDeserialized());
    } catch (Throwable t) {
        Assert.fail("Should not reach here!");
    }
}
 
Example #6
Source File: ClassCustomSerializerTest.java    From sofa-bolt with Apache License 2.0 6 votes vote down vote up
/**
 * test RuntimeException when serial response
 * @throws Exception
 */
@Test
public void testResponseSerialRuntimeException() throws Exception {
    NormalRequestBodyCustomSerializer s1 = new NormalRequestBodyCustomSerializer();
    ExceptionStringCustomSerializer s2 = new ExceptionStringCustomSerializer(false, true,
        false, false);
    CustomSerializerManager.registerCustomSerializer(RequestBody.class.getName(), s1);
    CustomSerializerManager.registerCustomSerializer(String.class.getName(), s2);

    RequestBody body = new RequestBody(1, "hello world!");
    String ret = null;
    try {
        ret = (String) client.invokeSync(addr, body, 1000);
        Assert.fail("Should not reach here!");
    } catch (SerializationException e) {
        logger.error("", e);
        Assert.assertTrue(e.isServerSide());
        Assert.assertEquals(null, ret);
        Assert.assertTrue(s1.isSerialized());
        Assert.assertTrue(s1.isDeserialized());
        Assert.assertTrue(s2.isSerialized());
        Assert.assertFalse(s2.isDeserialized());
    } catch (Throwable t) {
        Assert.fail("Should not reach here!");
    }
}
 
Example #7
Source File: SimpleMapSerializer.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
/**
 * 简单 map 的序列化过程, 用来序列化 bolt 的 header
 *
 * @param map bolt header
 * @return 序列化后的 byte 数组
 * @throws SerializationException SerializationException
 */
public byte[] encode(Map<String, String> map) throws SerializationException {
    if (map == null || map.isEmpty()) {
        return null;
    }
    UnsafeByteArrayOutputStream out = new UnsafeByteArrayOutputStream(64);
    try {
        for (Map.Entry<String, String> entry : map.entrySet()) {
            String key = entry.getKey();
            String value = entry.getValue();
            /**
             * 排除不写null作为key
             */
            if (key != null && value != null) {
                writeString(out, key);
                writeString(out, value);
            }
        }
        return out.toByteArray();
    } catch (IOException ex) {
        throw new SerializationException(ex.getMessage(), ex);
    }
}
 
Example #8
Source File: SofaRpcSerialization.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public <Response extends ResponseCommand> boolean serializeHeader(Response response)
    throws SerializationException {
    if (response instanceof RpcResponseCommand) {
        RpcInternalContext.getContext().getStopWatch().tick();

        Object responseObject = ((RpcResponseCommand) response).getResponseObject();
        if (responseObject instanceof SofaResponse) {
            SofaResponse sofaResponse = (SofaResponse) responseObject;
            if (sofaResponse.isError() || sofaResponse.getAppResponse() instanceof Throwable) {
                sofaResponse.addResponseProp(RemotingConstants.HEAD_RESPONSE_ERROR, StringUtils.TRUE);
            }
            response.setHeader(mapSerializer.encode(sofaResponse.getResponseProps()));
        }
        return true;
    }
    return false;
}
 
Example #9
Source File: SofaRpcSerialization.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public <Request extends RequestCommand> boolean serializeHeader(Request request, InvokeContext invokeContext)
    throws SerializationException {
    if (request instanceof RpcRequestCommand) {
        RpcInternalContext.getContext().getStopWatch().tick();

        RpcRequestCommand requestCommand = (RpcRequestCommand) request;
        Object requestObject = requestCommand.getRequestObject();
        String service = getTargetServiceName(requestObject);
        if (StringUtils.isNotEmpty(service)) {
            Map<String, String> header = new HashMap<String, String>(16);
            header.put(RemotingConstants.HEAD_SERVICE, service);
            putRequestMetadataToHeader(requestObject, header);
            requestCommand.setHeader(mapSerializer.encode(header));
        }
        return true;
    }
    return false;
}
 
Example #10
Source File: SofaRpcSerialization.java    From sofa-rpc with Apache License 2.0 6 votes vote down vote up
@Override
public <Response extends ResponseCommand> boolean serializeContent(Response response)
    throws SerializationException {
    if (response instanceof RpcResponseCommand) {
        RpcResponseCommand responseCommand = (RpcResponseCommand) response;
        byte serializerCode = response.getSerializer();
        try {
            Serializer rpcSerializer = com.alipay.sofa.rpc.codec.SerializerFactory.getSerializer(serializerCode);
            AbstractByteBuf byteBuf = rpcSerializer.encode(responseCommand.getResponseObject(), null);
            responseCommand.setContent(byteBuf.array());
            return true;
        } catch (Exception ex) {
            throw new SerializationException(ex.getMessage(), ex);
        } finally {
            recordSerializeResponse(responseCommand);
        }
    }
    return false;
}
 
Example #11
Source File: SofaRpcSerialization.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
@Override
public <Request extends RequestCommand> boolean serializeContent(Request request, InvokeContext invokeContext)
    throws SerializationException {
    if (request instanceof RpcRequestCommand) {
        RpcRequestCommand requestCommand = (RpcRequestCommand) request;
        Object requestObject = requestCommand.getRequestObject();
        byte serializerCode = requestCommand.getSerializer();
        try {
            Map<String, String> header = (Map<String, String>) requestCommand.getRequestHeader();
            if (header == null) {
                header = new HashMap<String, String>();
            }
            putKV(header, RemotingConstants.HEAD_GENERIC_TYPE,
                (String) invokeContext.get(RemotingConstants.HEAD_GENERIC_TYPE));

            Serializer rpcSerializer = com.alipay.sofa.rpc.codec.SerializerFactory
                .getSerializer(serializerCode);
            AbstractByteBuf byteBuf = rpcSerializer.encode(requestObject, header);
            request.setContent(byteBuf.array());
            return true;
        } catch (Exception ex) {
            throw new SerializationException(ex.getMessage(), ex);
        } finally {
            recordSerializeRequest(requestCommand, invokeContext);
        }
    }
    return false;
}
 
Example #12
Source File: NormalStringCustomSerializer_InvokeContext.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/**
 * @see CustomSerializer#serializeContent(ResponseCommand)
 */
@Override
public <T extends ResponseCommand> boolean serializeContent(T response)
                                                                       throws SerializationException {
    serialFlag.set(true);
    RpcResponseCommand rpcResp = (RpcResponseCommand) response;
    String str = (String) rpcResp.getResponseObject();
    try {
        rpcResp.setContent(str.getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }

    return true;
}
 
Example #13
Source File: NormalStringCustomSerializer.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/**
 * @see CustomSerializer#serializeContent(ResponseCommand)
 */
@Override
public <T extends ResponseCommand> boolean serializeContent(T response)
                                                                       throws SerializationException {
    serialFlag.set(true);
    RpcResponseCommand rpcResp = (RpcResponseCommand) response;
    String str = (String) rpcResp.getResponseObject();
    try {
        rpcResp.setContent(str.getBytes("UTF-8"));
    } catch (UnsupportedEncodingException e) {
        e.printStackTrace();
    }
    contentSerializer = response.getSerializer();
    return true;
}
 
Example #14
Source File: ProtobufSerializer.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends RequestCommand> boolean serializeContent(T request, InvokeContext invokeContext)
                                                                                                  throws SerializationException {
    final RpcRequestCommand cmd = (RpcRequestCommand) request;
    final Message msg = (Message) cmd.getRequestObject();
    cmd.setContent(msg.toByteArray());
    return true;
}
 
Example #15
Source File: ExceptionStringCustomSerializer.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/** 
 * @see CustomSerializer#serializeContent(ResponseCommand)
 */
@Override
public <T extends ResponseCommand> boolean serializeContent(T response)
                                                                       throws SerializationException {
    serialFlag.set(true);
    if (serialRuntimeException) {
        throw new RuntimeException("serialRuntimeException in ExceptionStringCustomSerializer!");
    } else if (serialException) {
        throw new SerializationException("serialException in ExceptionStringCustomSerializer!");
    } else {
        return false;// use default codec 
    }
}
 
Example #16
Source File: ProtobufSerializer.java    From sofa-jraft with Apache License 2.0 5 votes vote down vote up
@Override
public <T extends ResponseCommand> boolean serializeContent(T response) throws SerializationException {
    final RpcResponseCommand cmd = (RpcResponseCommand) response;
    final Message msg = (Message) cmd.getResponseObject();
    cmd.setContent(msg.toByteArray());
    return true;
}
 
Example #17
Source File: RpcRemoting.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/**
 * Convert application request object to remoting request command.
 * 
 * @param request
 * @param conn
 * @param timeoutMillis
 * @return
 * @throws CodecException
 */
protected RemotingCommand toRemotingCommand(Object request, Connection conn,
                                            InvokeContext invokeContext, int timeoutMillis)
                                                                                           throws SerializationException {
    RpcRequestCommand command = this.getCommandFactory().createRequestCommand(request);

    if (null != invokeContext) {
        // set client custom serializer for request command if not null
        Object clientCustomSerializer = invokeContext.get(InvokeContext.BOLT_CUSTOM_SERIALIZER);
        if (null != clientCustomSerializer) {
            try {
                command.setSerializer((Byte) clientCustomSerializer);
            } catch (ClassCastException e) {
                throw new IllegalArgumentException(
                    "Illegal custom serializer [" + clientCustomSerializer
                            + "], the type of value should be [byte], but now is ["
                            + clientCustomSerializer.getClass().getName() + "].");
            }
        }

        // enable crc by default, user can disable by set invoke context `false` for key `InvokeContext.BOLT_CRC_SWITCH`
        Boolean crcSwitch = invokeContext.get(InvokeContext.BOLT_CRC_SWITCH,
            ProtocolSwitch.CRC_SWITCH_DEFAULT_VALUE);
        if (null != crcSwitch && crcSwitch) {
            command.setProtocolSwitch(ProtocolSwitch
                .create(new int[] { ProtocolSwitch.CRC_SWITCH_INDEX }));
        }
    } else {
        // enable crc by default, if there is no invoke context.
        command.setProtocolSwitch(ProtocolSwitch
            .create(new int[] { ProtocolSwitch.CRC_SWITCH_INDEX }));
    }
    command.setTimeout(timeoutMillis);
    command.setRequestClass(request.getClass().getName());
    command.setInvokeContext(invokeContext);
    command.serialize();
    logDebugInfo(command);
    return command;
}
 
Example #18
Source File: RpcRequestCommand.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeClazz() throws SerializationException {
    if (this.requestClass != null) {
        try {
            byte[] clz = this.requestClass.getBytes(Configs.DEFAULT_CHARSET);
            this.setClazz(clz);
        } catch (UnsupportedEncodingException e) {
            throw new SerializationException("Unsupported charset: " + Configs.DEFAULT_CHARSET,
                e);
        }
    }
}
 
Example #19
Source File: ExceptionRequestBodyCustomSerializer.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/** 
 * @see CustomSerializer#serializeContent(RequestCommand, InvokeContext)
 */
@Override
public <T extends RequestCommand> boolean serializeContent(T req, InvokeContext invokeContext)
                                                                                              throws SerializationException {
    serialFlag.set(true);
    if (serialRuntimeException) {
        throw new RuntimeException(
            "serialRuntimeException in ExceptionRequestBodyCustomSerializer!");
    } else if (serialException) {
        throw new SerializationException(
            "serialException in ExceptionRequestBodyCustomSerializer!");
    } else {
        return false;// use default codec 
    }
}
 
Example #20
Source File: CustomHeaderSerializer.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/**
 * @see com.alipay.remoting.CustomSerializer#serializeHeader(com.alipay.remoting.rpc.RequestCommand, InvokeContext)
 */
@Override
public <T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
                                                                                                 throws SerializationException {
    if (request instanceof RpcRequestCommand) {
        RpcRequestCommand requestCommand = (RpcRequestCommand) request;
        try {
            requestCommand.setHeader(EXECUTOR1.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            System.err.println("UnsupportedEncodingException");
        }
        return true;
    }
    return false;
}
 
Example #21
Source File: CustomHeaderSerializer.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/**
 * @see com.alipay.remoting.CustomSerializer#serializeHeader(com.alipay.remoting.rpc.ResponseCommand)
 */
@Override
public <T extends ResponseCommand> boolean serializeHeader(T response)
                                                                      throws SerializationException {
    if (response instanceof RpcResponseCommand) {
        RpcResponseCommand responseCommand = (RpcResponseCommand) response;
        try {
            responseCommand.setHeader(EXECUTOR1.getBytes("UTF-8"));
        } catch (UnsupportedEncodingException e) {
            System.err.println("UnsupportedEncodingException");
        }
        return true;
    }
    return false;
}
 
Example #22
Source File: RpcResponseCommand.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
@Override
public void serializeClazz() throws SerializationException {
    if (this.getResponseClass() != null) {
        try {
            byte[] clz = this.getResponseClass().getBytes(Configs.DEFAULT_CHARSET);
            this.setClazz(clz);
        } catch (UnsupportedEncodingException e) {
            throw new SerializationException("Unsupported charset: " + Configs.DEFAULT_CHARSET,
                e);
        }
    }
}
 
Example #23
Source File: DefaultCustomSerializer.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/** 
 * @see com.alipay.remoting.CustomSerializer#serializeContent(com.alipay.remoting.rpc.RequestCommand, InvokeContext)
 */
@Override
public <T extends RequestCommand> boolean serializeContent(T request,
                                                           InvokeContext invokeContext)
                                                                                       throws SerializationException {
    return false;
}
 
Example #24
Source File: RpcCommand.java    From sofa-bolt with Apache License 2.0 5 votes vote down vote up
/**
 * Serialize  the class header and content.
 * 
 * @throws Exception
 */
@Override
public void serialize() throws SerializationException {
    this.serializeClazz();
    this.serializeHeader(this.invokeContext);
    this.serializeContent(this.invokeContext);
}
 
Example #25
Source File: BoltClientTransportTest.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
@Test
public void testConvertToRpcException() {
    ClientTransportConfig config1 = new ClientTransportConfig();
    config1.setProviderInfo(new ProviderInfo().setHost("127.0.0.1").setPort(12222))
        .setContainer("bolt");
    BoltClientTransport transport = new BoltClientTransport(config1);
    Assert.assertTrue(transport
        .convertToRpcException(new SofaRpcException(RpcErrorType.CLIENT_UNDECLARED_ERROR, ""))
        instanceof SofaRpcException);
    Assert.assertTrue(transport.convertToRpcException(new InvokeTimeoutException())
        instanceof SofaTimeOutException);
    Assert.assertTrue(transport.convertToRpcException(new InvokeServerBusyException())
        .getErrorType() == RpcErrorType.SERVER_BUSY);
    Assert.assertTrue(transport.convertToRpcException(new SerializationException("xx", true))
        .getErrorType() == RpcErrorType.SERVER_SERIALIZE);
    Assert.assertTrue(transport.convertToRpcException(new SerializationException("xx", false))
        .getErrorType() == RpcErrorType.CLIENT_SERIALIZE);
    Assert.assertTrue(transport.convertToRpcException(new DeserializationException("xx", true))
        .getErrorType() == RpcErrorType.SERVER_DESERIALIZE);
    Assert.assertTrue(transport.convertToRpcException(new DeserializationException("xx", false))
        .getErrorType() == RpcErrorType.CLIENT_DESERIALIZE);
    Assert.assertTrue(transport.convertToRpcException(new ConnectionClosedException())
        .getErrorType() == RpcErrorType.CLIENT_NETWORK);
    Assert.assertTrue(transport.convertToRpcException(new InvokeSendFailedException())
        .getErrorType() == RpcErrorType.CLIENT_NETWORK);
    Assert.assertTrue(transport.convertToRpcException(new InvokeServerException())
        .getErrorType() == RpcErrorType.SERVER_UNDECLARED_ERROR);
    Assert.assertTrue(transport.convertToRpcException(new UnsupportedOperationException())
        .getErrorType() == RpcErrorType.CLIENT_UNDECLARED_ERROR);
}
 
Example #26
Source File: ProtobufSerializer.java    From sofa-jraft with Apache License 2.0 4 votes vote down vote up
@Override
public <T extends ResponseCommand> boolean serializeHeader(T response) throws SerializationException {
    return false;
}
 
Example #27
Source File: DefaultCustomSerializer.java    From sofa-bolt with Apache License 2.0 4 votes vote down vote up
/** 
 * @see com.alipay.remoting.CustomSerializer#serializeContent(com.alipay.remoting.rpc.ResponseCommand)
 */
@Override
public <T extends ResponseCommand> boolean serializeContent(T response)
                                                                       throws SerializationException {
    return false;
}
 
Example #28
Source File: DefaultCustomSerializer.java    From sofa-bolt with Apache License 2.0 4 votes vote down vote up
/** 
 * @see com.alipay.remoting.CustomSerializer#serializeHeader(com.alipay.remoting.rpc.ResponseCommand)
 */
@Override
public <T extends ResponseCommand> boolean serializeHeader(T response)
                                                                      throws SerializationException {
    return false;
}
 
Example #29
Source File: DefaultCustomSerializer.java    From sofa-bolt with Apache License 2.0 4 votes vote down vote up
/** 
 * @see com.alipay.remoting.CustomSerializer#serializeHeader(com.alipay.remoting.rpc.RequestCommand, InvokeContext)
 */
@Override
public <T extends RequestCommand> boolean serializeHeader(T request, InvokeContext invokeContext)
                                                                                                 throws SerializationException {
    return false;
}
 
Example #30
Source File: CustomSerializer.java    From sofa-bolt with Apache License 2.0 2 votes vote down vote up
/**
 * Serialize the content of ResponseCommand.
 * 
 * @param response
 * @return
 * @throws CodecException
 */
<T extends ResponseCommand> boolean serializeContent(T response) throws SerializationException;