@Test
    public void testAttachment() {
        Assert.assertTrue(RpcInternalContext.isAttachmentEnable());
        RpcInternalContext context = RpcInternalContext.getContext();
        boolean error = false;
        try {
            context.setAttachment("1", "1");
        } catch (Exception e) {
            error = true;
        }
        Assert.assertTrue(error);

        Map<String, Object> map = new HashMap<String, Object>();
        map.put("_11", "1111");
        map.put("_22", "2222");
        map.put(".33", "3333");
        context.setAttachments(map);
        Assert.assertEquals("1111", context.getAttachment("_11"));
        context.setAttachment(null, "22222");
        context.setAttachment("_22", null);
        Assert.assertNull(context.getAttachment(null));
        Assert.assertNull(context.getAttachment("_22"));

        Assert.assertNull(context.removeAttachment("_33"));
        Assert.assertEquals("3333", context.removeAttachment(".33"));

        context.clearAttachments();
        Assert.assertNull(context.removeAttachment("11"));
    }
@author <a href="mailto:zhanggeng.zg@antfin.com">GengZhang</a>
core/api/src/test/java/com/alipay/sofa/rpc/context/RpcInternalContextTest.java