@Test
public void flatCopyTo() {

    Map<String, Object> requestProps = new HashMap<String, Object>();
    requestProps.put("xx", "xxxxxxx");
    requestProps.put("yyy", new String[] { "yyyy" }); // string数组无法传递
    requestProps.put("zzzz", 333);
    Map<String, String> header = new HashMap<String, String>();
    Map<String, String> context = new HashMap<String, String>();
    context.put("sofaCallerApp", "test");
    context.put("sofaCallerIp", "10.15.233.63");
    context.put("sofaPenAttrs", "");
    context.put("sofaRpcId", "0");
    context.put("sofaTraceId", "0a0fe93f1488349732342100153695");
    context.put("sysPenAttrs", "");
    context.put("penAttrs", "Hello=world&");
    String rpcTraceContext = "rpc_trace_context";
    requestProps.put(rpcTraceContext, context);
    Map<String, String> requestBaggage = new HashMap<String, String>();
    requestBaggage.put("aaa", "reqasdhjaksdhaksdyiasdhasdhaskdhaskd");
    requestBaggage.put("bbb", "req10.15.233.63");
    requestBaggage.put("ccc", "reqwhat 's wrong");
    String rpcReqBaggage = "rpc_req_baggage";
    requestProps.put(rpcReqBaggage, requestBaggage);
    Map<String, String> responseBaggage = new HashMap<String, String>();
    responseBaggage.put("xxx", "respasdhjaksdhaksdyiasdhasdhaskdhaskd");
    responseBaggage.put("yyy", "resp10.15.233.63");
    responseBaggage.put("zzz", "resphehehe");
    String rpcRespBaggage = "rpc_resp_baggage";
    requestProps.put(rpcRespBaggage, responseBaggage);
    //        rpcSerialization.
    CodecUtils.flatCopyTo("", requestProps, header);
    Assert.assertTrue(header.size() == 15);
    for (Map.Entry<String, String> entry : header.entrySet()) {
        LOGGER.info(entry.getKey() + " : " + entry.getValue());
    }
    LOGGER.info("");
    Map<String, Object> newRequestProps = new HashMap<String, Object>();
    Map<String, String> newContext = new HashMap<String, String>();
    CodecUtils.treeCopyTo(rpcTraceContext + ".", header, newContext, true);
    newRequestProps.put(rpcTraceContext, newContext);
    newContext = new HashMap<String, String>();
    CodecUtils.treeCopyTo(rpcReqBaggage + ".", header, newContext,
        true);
    newRequestProps.put(rpcReqBaggage, newContext);
    newContext = new HashMap<String, String>();
    CodecUtils.treeCopyTo(rpcRespBaggage + ".", header,
        newContext, true);
    newRequestProps.put(rpcRespBaggage, newContext);
    for (Map.Entry<String, Object> entry : newRequestProps.entrySet()) {
        LOGGER.info(entry.getKey() + " : " + entry.getValue());
    }
    newRequestProps.putAll(header);
    Assert.assertTrue(newRequestProps.size() == 5);
}