### Question:
BoltChannelUtil { public static Byte getBoltCustomSerializer(Channel channel) { if (channel instanceof BoltChannel) { BoltChannel boltChannel = (BoltChannel) channel; InvokeContext invokeContext = boltChannel.getBizContext().getInvokeContext(); if (null != invokeContext) { Object clientCustomCodec = invokeContext.get(InvokeContext.BOLT_CUSTOM_SERIALIZER); if (null != clientCustomCodec) { try { return (Byte) clientCustomCodec; } catch (ClassCastException e) { throw new IllegalArgumentException( "Illegal custom codec [" + clientCustomCodec + "], the type of value should be [byte], but now is [" + clientCustomCodec.getClass().getName() + "]."); } } } } return null; }  static Byte getBoltCustomSerializer(Channel channel);  }### Answer:
@Test public void testGetBoltCustomSerializer() { Assert.assertNull(BoltChannelUtil.getBoltCustomSerializer(new MockChannel())); BoltChannel boltChannel = new BoltChannel(); InvokeContext invokeContext = new InvokeContext(); invokeContext.put(InvokeContext.BOLT_CUSTOM_SERIALIZER, new Object()); RemotingContext remotingContext = new RemotingContext(new MockChannelHandlerContext(), invokeContext, false, new ConcurrentHashMap<>()); BizContext bizContext = new DefaultBizContext(remotingContext); boltChannel.setBizContext(bizContext); boolean isException = false; try { BoltChannelUtil.getBoltCustomSerializer(boltChannel); } catch (Throwable r) { isException = true; } Assert.assertTrue(isException); invokeContext.put(InvokeContext.BOLT_CUSTOM_SERIALIZER, new Byte("3")); Assert.assertEquals(new Byte("3"), BoltChannelUtil.getBoltCustomSerializer(boltChannel)); }