BoltClientProxyInvoker extends DefaultClientProxyInvoker { @Override protected Byte parseSerializeType(String serialization) { Byte serializeType; if (SERIALIZE_HESSIAN.equals(serialization) || SERIALIZE_HESSIAN2.equals(serialization)) { serializeType = RemotingConstants.SERIALIZE_CODE_HESSIAN; } else if (SERIALIZE_PROTOBUF.equals(serialization)) { serializeType = RemotingConstants.SERIALIZE_CODE_PROTOBUF; } else if (SERIALIZE_JAVA.equals(serialization)) { serializeType = RemotingConstants.SERIALIZE_CODE_JAVA; } else { serializeType = super.parseSerializeType(serialization); } return serializeType; } BoltClientProxyInvoker(ConsumerBootstrap bootstrap);   }
@Test public void testParseSerializeType() throws Exception { ConsumerConfig consumerConfig = new ConsumerConfig().setProtocol("bolt"); ConsumerBootstrap bootstrap = Bootstraps.from(consumerConfig); BoltClientProxyInvoker invoker = new BoltClientProxyInvoker(bootstrap); byte actual = invoker.parseSerializeType(RpcConstants.SERIALIZE_HESSIAN2); assertEquals(RemotingConstants.SERIALIZE_CODE_HESSIAN, actual); }
@Test(expected = SofaRpcRuntimeException.class) public void testParseSerializeTypeException() { ConsumerConfig consumerConfig = new ConsumerConfig().setProtocol("bolt"); ConsumerBootstrap bootstrap = Bootstraps.from(consumerConfig); BoltClientProxyInvoker invoker = new BoltClientProxyInvoker(bootstrap); invoker.parseSerializeType("unknown"); }