@Override public void serverConnecting(RPCContext context) { Assert.assertNotNull(context.requestHandshakeMeta()); Assert.assertNotNull(context.responseHandshakeMeta()); Assert.assertNull(context.getRequestPayload()); Assert.assertNull(context.getResponsePayload()); if (!context.requestHandshakeMeta().containsKey(key)) return; ByteBuffer buf = context.requestHandshakeMeta().get(key); Assert.assertNotNull(buf); Assert.assertNotNull(buf.array()); String partialstr = new String(buf.array()); Assert.assertNotNull(partialstr); Assert.assertEquals("partial string mismatch", "ap", partialstr); buf = ByteBuffer.wrap((partialstr + "ac").getBytes()); Assert.assertTrue(buf.remaining() > 0); context.responseHandshakeMeta().put(key, buf); }
@Override public void clientStartConnect(RPCContext context) { ByteBuffer buf = ByteBuffer.wrap("ap".getBytes()); context.requestHandshakeMeta().put(key, buf); }