@Test
public void testClear() {

    RpcInternalContext context = RpcInternalContext.getContext();
    context.setRemoteAddress("127.0.0.1", 1234);
    context.setLocalAddress("127.0.0.1", 2345);
    context.setFuture(new ResponseFuture<String>() {
        @Override
        public boolean cancel(boolean mayInterruptIfRunning) {
            return false;
        }
        @Override
        public boolean isCancelled() {
            return false;
        }
        @Override
        public boolean isDone() {
            return false;
        }
        @Override
        public String get() throws InterruptedException, ExecutionException {
            return null;
        }
        @Override
        public String get(long timeout, TimeUnit unit) throws InterruptedException, ExecutionException,
            TimeoutException {
            return null;
        }
        @Override
        public ResponseFuture addListeners(List<SofaResponseCallback> sofaResponseCallbacks) {
            return null;
        }
        @Override
        public ResponseFuture addListener(SofaResponseCallback sofaResponseCallback) {
            return null;
        }
    });
    context.setProviderInfo(ProviderHelper.toProviderInfo("127.0.0.1:80"));
    context.setAttachment("_xxxx", "yyyy");
    context.clear();
    Assert.assertNull(context.getRemoteAddress());
    Assert.assertNull(context.getLocalAddress());
    Assert.assertNull(context.getFuture());
    Assert.assertFalse(context.isProviderSide());
    Assert.assertFalse(context.isConsumerSide());
    Assert.assertNull(context.getProviderInfo());
    Assert.assertTrue(context.getAttachments().isEmpty());
    Assert.assertNotNull(context.getStopWatch());
    Assert.assertTrue(context.getStopWatch().read() == 0);
    Assert.assertNotNull(context.toString());
}