Java Code Examples for com.caucho.hessian.io.Hessian2Input#close()
The following examples show how to use
com.caucho.hessian.io.Hessian2Input#close() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SimpleTesGO2GO.java From sofa-hessian with Apache License 2.0 | 6 votes |
@org.junit.Test public void testBoolean() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new GenericSerializerFactory()); hout.writeObject(dg.generateTrue()); hout.writeObject(dg.generateFalse()); hout.writeObject(dg.generateTrue()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(true, hin.readObject()); assertEquals(false, hin.readObject()); assertEquals(true, hin.readObject()); hin.close(); }
Example 2
Source File: SimpleTestO2GO.java From sofa-hessian with Apache License 2.0 | 6 votes |
@org.junit.Test public void testBoolean() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new SerializerFactory()); hout.writeObject(dg.generateTrue()); hout.writeObject(dg.generateFalse()); hout.writeObject(dg.generateTrue()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(true, hin.readObject()); assertEquals(false, hin.readObject()); assertEquals(true, hin.readObject()); hin.close(); }
Example 3
Source File: SimpleTestGO2O.java From sofa-hessian with Apache License 2.0 | 6 votes |
@org.junit.Test public void testNull() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new GenericSerializerFactory()); hout.writeObject(dg.generateNull()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new SerializerFactory()); assertNull(hin.readObject()); hin.close(); }
Example 4
Source File: SimpleTestO2GO.java From sofa-hessian with Apache License 2.0 | 6 votes |
@org.junit.Test public void testDate() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new SerializerFactory()); hout.writeObject(dg.generateDate_0()); hout.writeObject(dg.generateDate_1()); hout.writeObject(dg.generateDate_2()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(dg.generateDate_0(), hin.readObject()); assertEquals(dg.generateDate_1(), hin.readObject()); assertEquals(dg.generateDate_2(), hin.readObject()); hin.close(); }
Example 5
Source File: HessianExample.java From pragmatic-java-engineer with GNU General Public License v3.0 | 6 votes |
public static void main(String[] args) throws IOException { //序列化 ByteArrayOutputStream os = new ByteArrayOutputStream(); Hessian2Output out = new Hessian2Output(os); out.startMessage(); TestUser user = new TestUser(); out.writeObject(user); out.completeMessage(); out.flush(); byte[] bytes = os.toByteArray(); out.close(); os.close(); //反序列化 ByteArrayInputStream ins = new ByteArrayInputStream(bytes); Hessian2Input input = new Hessian2Input(ins); input.startMessage(); user = (TestUser) input.readObject(); input.completeMessage(); input.close(); ins.close(); }
Example 6
Source File: SimpleTestGO2O.java From sofa-hessian with Apache License 2.0 | 6 votes |
@org.junit.Test public void testDate() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new GenericSerializerFactory()); hout.writeObject(dg.generateDate_0()); hout.writeObject(dg.generateDate_1()); hout.writeObject(dg.generateDate_2()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new SerializerFactory()); assertEquals(dg.generateDate_0(), hin.readObject()); assertEquals(dg.generateDate_1(), hin.readObject()); assertEquals(dg.generateDate_2(), hin.readObject()); hin.close(); }
Example 7
Source File: HessianSerializer.java From Jupiter with Apache License 2.0 | 6 votes |
@Override public <T> T readObject(InputBuf inputBuf, Class<T> clazz) { Hessian2Input input = Inputs.getInput(inputBuf); try { Object obj = input.readObject(clazz); return clazz.cast(obj); } catch (IOException e) { ThrowUtil.throwException(e); } finally { try { input.close(); } catch (IOException ignored) {} inputBuf.release(); } return null; // never get here }
Example 8
Source File: Hessian2Serializable.java From light-task-scheduler with Apache License 2.0 | 5 votes |
@SuppressWarnings("unchecked") @Override public <T> T deserialize(byte[] data, Class<T> clazz) throws Exception { UnsafeByteArrayInputStream bin = new UnsafeByteArrayInputStream(data); Hessian2Input in = new Hessian2Input(bin); in.startMessage(); Object obj = in.readObject(clazz); in.completeMessage(); in.close(); return (T) obj; }
Example 9
Source File: HessianSerializer.java From Jupiter with Apache License 2.0 | 5 votes |
@Override public <T> T readObject(byte[] bytes, int offset, int length, Class<T> clazz) { Hessian2Input input = Inputs.getInput(bytes, offset, length); try { Object obj = input.readObject(clazz); return clazz.cast(obj); } catch (IOException e) { ThrowUtil.throwException(e); } finally { try { input.close(); } catch (IOException ignored) {} } return null; // never get here }
Example 10
Source File: SimpleTestO2GO.java From sofa-hessian with Apache License 2.0 | 5 votes |
@org.junit.Test public void testList() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new SerializerFactory()); hout.writeObject(dg.generateUntypedFixedList_0()); hout.writeObject(dg.generateUntypedFixedList_1()); hout.writeObject(dg.generateUntypedFixedList_7()); hout.writeObject(dg.generateUntypedFixedList_8()); hout.writeObject(dg.generateTypedFixedList_0()); hout.writeObject(dg.generateTypedFixedList_1()); hout.writeObject(dg.generateTypedFixedList_7()); hout.writeObject(dg.generateTypedFixedList_8()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(dg.generateUntypedFixedList_0(), hin.readObject()); assertEquals(dg.generateUntypedFixedList_1(), hin.readObject()); assertEquals(dg.generateUntypedFixedList_7(), hin.readObject()); assertEquals(dg.generateUntypedFixedList_8(), hin.readObject()); assertTrue(Arrays.equals((Object[]) dg.generateTypedFixedList_0(), (Object[]) hin.readObject())); assertTrue(Arrays.equals((Object[]) dg.generateTypedFixedList_1(), (Object[]) hin.readObject())); assertTrue(Arrays.equals((Object[]) dg.generateTypedFixedList_7(), (Object[]) hin.readObject())); assertTrue(Arrays.equals((Object[]) dg.generateTypedFixedList_8(), (Object[]) hin.readObject())); hin.close(); }
Example 11
Source File: SimpleTestGO2O.java From sofa-hessian with Apache License 2.0 | 5 votes |
@org.junit.Test public void testMap() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new GenericSerializerFactory()); hout.writeObject(dg.generateUntypedMap_0()); hout.writeObject(dg.generateUntypedMap_1()); hout.writeObject(dg.generateUntypedMap_2()); hout.writeObject(dg.generateUntypedMap_3()); hout.writeObject(dg.generateTypedMap_0()); hout.writeObject(dg.generateTypedMap_1()); hout.writeObject(dg.generateTypedMap_2()); hout.writeObject(dg.generateTypedMap_3()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new SerializerFactory()); assertEquals(dg.generateUntypedMap_0(), hin.readObject()); assertEquals(dg.generateUntypedMap_1(), hin.readObject()); assertEquals(dg.generateUntypedMap_2(), hin.readObject()); assertEquals(dg.generateUntypedMap_3(), hin.readObject()); assertEquals(dg.generateTypedMap_0(), hin.readObject()); assertEquals(dg.generateTypedMap_1(), hin.readObject()); assertEquals(dg.generateTypedMap_2(), hin.readObject()); assertEquals(dg.generateTypedMap_3(), hin.readObject()); hin.close(); }
Example 12
Source File: SimpleTestGO2O.java From sofa-hessian with Apache License 2.0 | 5 votes |
@org.junit.Test public void testBinary() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new GenericSerializerFactory()); hout.writeObject(dg.generateBinary_0()); hout.writeObject(dg.generateBinary_null()); hout.writeObject(dg.generateBinary_1()); hout.writeObject(dg.generateBinary_15()); hout.writeObject(dg.generateBinary_16()); hout.writeObject(dg.generateBinary_1023()); hout.writeObject(dg.generateBinary_1024()); hout.writeObject(dg.generateBinary_65536()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new SerializerFactory()); assertTrue(compareByteArray(dg.generateBinary_0(), hin.readObject())); assertNull(hin.readObject()); assertTrue(compareByteArray(dg.generateBinary_1(), hin.readObject())); assertTrue(compareByteArray(dg.generateBinary_15(), hin.readObject())); assertTrue(compareByteArray(dg.generateBinary_16(), hin.readObject())); assertTrue(compareByteArray(dg.generateBinary_1023(), hin.readObject())); assertTrue(compareByteArray(dg.generateBinary_1024(), hin.readObject())); assertTrue(compareByteArray(dg.generateBinary_65536(), hin.readObject())); hin.close(); }
Example 13
Source File: SimpleTestO2GO.java From sofa-hessian with Apache License 2.0 | 5 votes |
@org.junit.Test public void testString() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new SerializerFactory()); hout.writeObject(dg.generateString_0()); hout.writeObject(dg.generateString_null()); hout.writeObject(dg.generateString_1()); hout.writeObject(dg.generateString_31()); hout.writeObject(dg.generateString_32()); hout.writeObject(dg.generateString_1023()); hout.writeObject(dg.generateString_1024()); hout.writeObject(dg.generateString_65536()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(dg.generateString_0(), hin.readObject()); assertEquals(dg.generateString_null(), hin.readObject()); assertEquals(dg.generateString_1(), hin.readObject()); assertEquals(dg.generateString_31(), hin.readObject()); assertEquals(dg.generateString_32(), hin.readObject()); assertEquals(dg.generateString_1023(), hin.readObject()); assertEquals(dg.generateString_1024(), hin.readObject()); assertEquals(dg.generateString_65536(), hin.readObject()); hin.close(); }
Example 14
Source File: SofaRequestHessianSerializer.java From sofa-rpc with Apache License 2.0 | 5 votes |
@Override public SofaRequest decodeObject(AbstractByteBuf data, Map<String, String> context) throws SofaRpcException { try { UnsafeByteArrayInputStream inputStream = new UnsafeByteArrayInputStream(data.array()); Hessian2Input input = new Hessian2Input(inputStream); input.setSerializerFactory(serializerFactory); Object object = input.readObject(); SofaRequest sofaRequest = (SofaRequest) object; String targetServiceName = sofaRequest.getTargetServiceUniqueName(); if (targetServiceName == null) { throw buildDeserializeError("Target service name of request is null!"); } String interfaceName = ConfigUniqueNameGenerator.getInterfaceName(targetServiceName); sofaRequest.setInterfaceName(interfaceName); String[] sig = sofaRequest.getMethodArgSigs(); Class<?>[] classSig = ClassTypeUtils.getClasses(sig); final Object[] args = new Object[sig.length]; for (int i = 0; i < sofaRequest.getMethodArgSigs().length; ++i) { args[i] = input.readObject(classSig[i]); } sofaRequest.setMethodArgs(args); input.close(); return sofaRequest; } catch (IOException e) { throw buildDeserializeError(e.getMessage(), e); } }
Example 15
Source File: SofaResponseHessianSerializer.java From sofa-rpc with Apache License 2.0 | 5 votes |
@Override public void decodeObjectByTemplate(AbstractByteBuf data, Map<String, String> context, SofaResponse template) throws SofaRpcException { try { UnsafeByteArrayInputStream inputStream = new UnsafeByteArrayInputStream(data.array()); Hessian2Input input = new Hessian2Input(inputStream); // 根据SerializeType信息决定序列化器 boolean genericSerialize = context != null && isGenericResponse( context.get(RemotingConstants.HEAD_GENERIC_TYPE)); if (genericSerialize) { input.setSerializerFactory(genericSerializerFactory); GenericObject genericObject = (GenericObject) input.readObject(); template.setErrorMsg((String) genericObject.getField("errorMsg")); template.setAppResponse(genericObject.getField("appResponse")); template.setResponseProps((Map<String, String>) genericObject.getField("responseProps")); } else { input.setSerializerFactory(serializerFactory); SofaResponse tmp = (SofaResponse) input.readObject(); // copy values to template template.setErrorMsg(tmp.getErrorMsg()); template.setAppResponse(tmp.getAppResponse()); template.setResponseProps(tmp.getResponseProps()); } input.close(); } catch (IOException e) { throw buildDeserializeError(e.getMessage(), e); } }
Example 16
Source File: SofaHessianSerializeService.java From spring-boot-starter-grpc with MIT License | 5 votes |
@Override public GrpcRequest deserialize(GrpcService.Request request) { byte[] bytes = request.getRequest().toByteArray(); UnsafeByteArrayInputStream inputStream = new UnsafeByteArrayInputStream(bytes); try { Hessian2Input input = new Hessian2Input(inputStream); input.setSerializerFactory(serializerFactory); GrpcRequest grpcRequest = (GrpcRequest) input.readObject(); input.close(); return grpcRequest; } catch (IOException e) { throw new GrpcException("sofa-hessian deserialize fail: " + e.getMessage()); } }
Example 17
Source File: ComplexTestMix.java From sofa-hessian with Apache License 2.0 | 4 votes |
@Test public void testSofaRequest() throws IOException { SofaRequest request = dg.generateSofaRequest(); // serialization uses GenericHessian ByteArrayOutputStream byteArray = new ByteArrayOutputStream(); Hessian2Output output = new Hessian2Output(byteArray); output.setSerializerFactory(new GenericSerializerFactory()); output.writeObject(request); final Object[] args = request.getMethodArgs(); if (args != null) { for (int i = 0; i < args.length; i++) { output.writeObject(args[i]); } } output.close(); byteArray.close(); // deserialization uses Hessian byte[] body = byteArray.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new SerializerFactory()); SofaRequest deRequest = (SofaRequest) hin.readObject(); String[] sig = deRequest.getMethodArgSigs(); Class<?>[] classSig = new Class[sig.length]; final Object[] deArgs = new Object[sig.length]; for (int i = 0; i < deRequest.getMethodArgSigs().length; ++i) { deArgs[i] = hin.readObject(classSig[i]); } deRequest.setMethodArgs(deArgs); bin.close(); hin.close(); assertEquals(request.getTargetServiceUniqueName(), deRequest.getTargetServiceUniqueName()); assertEquals(request.getMethodName(), deRequest.getMethodName()); assertEquals(request.getTargetAppName(), deRequest.getTargetAppName()); assertEquals(request.getRequestProps(), deRequest.getRequestProps()); // 1st argument is a Person, and 2nd argument is an int cmpGPersonEqualPerson((GenericObject) request.getMethodArgs()[0], (Person) deRequest.getMethodArgs()[0]); assertEquals(request.getMethodArgs()[1], deRequest.getMethodArgs()[1]); }
Example 18
Source File: SimpleTestO2GO.java From sofa-hessian with Apache License 2.0 | 4 votes |
@org.junit.Test public void testObject() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); SerializerFactory factory = new SerializerFactory(); factory.setAllowNonSerializable(true); hout.setSerializerFactory(factory); Object obj1 = dg.generateObject_0(); Object obj2 = dg.generateObject_16(); Object obj3 = dg.generateObject_1(); Object obj4 = dg.generateObject_2(); Object obj5 = dg.generateObject_2a(); Object obj6 = dg.generateObject_2b(); Object obj7 = dg.generateObject_3(); hout.writeObject(obj1); hout.writeObject(obj2); hout.writeObject(obj3); hout.writeObject(obj4); hout.writeObject(obj5); hout.writeObject(obj6); hout.writeObject(obj7); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); Object dobj1 = hin.readObject(); Object dobj2 = hin.readObject(); Object dobj3 = hin.readObject(); Object dobj4 = hin.readObject(); Object dobj5 = hin.readObject(); Object dobj6 = hin.readObject(); Object dobj7 = hin.readObject(); assertEquals(obj1.getClass().getName(), ((GenericObject) dobj1).getType()); List listO2 = (List) obj2; List listGO2 = (List) dobj2; for (int i = 0; i < listO2.size(); ++i) assertEquals(listO2.get(i).getClass().getName(), ((GenericObject) listGO2.get(i)).getType()); assertEquals(obj3.getClass().getName(), ((GenericObject) dobj3).getType()); assertEquals(((TestObject) obj3).getValue(), ((GenericObject) dobj3).getField("_value")); List listO4 = (List) obj4; List listGO4 = (List) dobj4; assertEquals(listO4.get(0).getClass().getName(), ((GenericObject) listGO4.get(0)).getType()); assertEquals(((TestObject) listO4.get(0)).getValue(), ((GenericObject) listGO4.get(0)).getField("_value")); assertEquals(listO4.get(1).getClass().getName(), ((GenericObject) listGO4.get(1)).getType()); assertEquals(((TestObject) listO4.get(1)).getValue(), ((GenericObject) listGO4.get(1)).getField("_value")); List listO5 = (List) obj5; List listGO5 = (List) dobj5; assertEquals(listO5.get(0).getClass().getName(), ((GenericObject) listGO5.get(0)).getType()); assertEquals(((TestObject) listO5.get(0)).getValue(), ((GenericObject) listGO5.get(0)).getField("_value")); assertSame(listGO5.get(0), listGO5.get(1)); List listO6 = (List) obj6; List listGO6 = (List) dobj6; assertEquals(listO6.get(0).getClass().getName(), ((GenericObject) listGO6.get(0)).getType()); assertEquals(((TestObject) listO6.get(0)).getValue(), ((GenericObject) listGO6.get(0)).getField("_value")); assertEquals(listO6.get(1).getClass().getName(), ((GenericObject) listGO6.get(1)).getType()); assertEquals(((TestObject) listO6.get(1)).getValue(), ((GenericObject) listGO6.get(1)).getField("_value")); GenericObject gobj7 = (GenericObject) dobj7; assertEquals(obj7.getClass().getName(), gobj7.getType()); assertSame(gobj7, gobj7.getField("_rest")); hin.close(); }
Example 19
Source File: SimpleTesGO2GO.java From sofa-hessian with Apache License 2.0 | 4 votes |
@org.junit.Test public void testDoubles() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new GenericSerializerFactory()); hout.writeObject(dg.generateDouble_0_0()); hout.writeObject(dg.generateDouble_1_0()); hout.writeObject(dg.generateDouble_2_0()); hout.writeObject(dg.generateDouble_127_0()); hout.writeObject(dg.generateDouble_m128_0()); hout.writeObject(dg.generateDouble_128_0()); hout.writeObject(dg.generateDouble_m129_0()); hout.writeObject(dg.generateDouble_32767_0()); hout.writeObject(dg.generateDouble_m32768_0()); hout.writeObject(dg.generateDouble_0_001()); hout.writeObject(dg.generateDouble_m0_001()); hout.writeObject(dg.generateDouble_65_536()); hout.writeObject(dg.generateDouble_3_14159()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(dg.generateDouble_0_0(), hin.readObject()); assertEquals(dg.generateDouble_1_0(), hin.readObject()); assertEquals(dg.generateDouble_2_0(), hin.readObject()); assertEquals(dg.generateDouble_127_0(), hin.readObject()); assertEquals(dg.generateDouble_m128_0(), hin.readObject()); assertEquals(dg.generateDouble_128_0(), hin.readObject()); assertEquals(dg.generateDouble_m129_0(), hin.readObject()); assertEquals(dg.generateDouble_32767_0(), hin.readObject()); assertEquals(dg.generateDouble_m32768_0(), hin.readObject()); assertEquals(dg.generateDouble_0_001(), hin.readObject()); assertEquals(dg.generateDouble_m0_001(), hin.readObject()); assertEquals(dg.generateDouble_65_536(), hin.readObject()); assertEquals(dg.generateDouble_3_14159(), hin.readObject()); hin.close(); }
Example 20
Source File: SimpleTestO2GO.java From sofa-hessian with Apache License 2.0 | 4 votes |
@org.junit.Test public void testDoubles() throws IOException { ByteArrayOutputStream bout = new ByteArrayOutputStream(); Hessian2Output hout = new Hessian2Output(bout); hout.setSerializerFactory(new SerializerFactory()); hout.writeObject(dg.generateDouble_0_0()); hout.writeObject(dg.generateDouble_1_0()); hout.writeObject(dg.generateDouble_2_0()); hout.writeObject(dg.generateDouble_127_0()); hout.writeObject(dg.generateDouble_m128_0()); hout.writeObject(dg.generateDouble_128_0()); hout.writeObject(dg.generateDouble_m129_0()); hout.writeObject(dg.generateDouble_32767_0()); hout.writeObject(dg.generateDouble_m32768_0()); hout.writeObject(dg.generateDouble_0_001()); hout.writeObject(dg.generateDouble_m0_001()); hout.writeObject(dg.generateDouble_65_536()); hout.writeObject(dg.generateDouble_3_14159()); hout.close(); byte[] body = bout.toByteArray(); ByteArrayInputStream bin = new ByteArrayInputStream(body, 0, body.length); Hessian2Input hin = new Hessian2Input(bin); hin.setSerializerFactory(new GenericSerializerFactory()); assertEquals(dg.generateDouble_0_0(), hin.readObject()); assertEquals(dg.generateDouble_1_0(), hin.readObject()); assertEquals(dg.generateDouble_2_0(), hin.readObject()); assertEquals(dg.generateDouble_127_0(), hin.readObject()); assertEquals(dg.generateDouble_m128_0(), hin.readObject()); assertEquals(dg.generateDouble_128_0(), hin.readObject()); assertEquals(dg.generateDouble_m129_0(), hin.readObject()); assertEquals(dg.generateDouble_32767_0(), hin.readObject()); assertEquals(dg.generateDouble_m32768_0(), hin.readObject()); assertEquals(dg.generateDouble_0_001(), hin.readObject()); assertEquals(dg.generateDouble_m0_001(), hin.readObject()); assertEquals(dg.generateDouble_65_536(), hin.readObject()); assertEquals(dg.generateDouble_3_14159(), hin.readObject()); hin.close(); }