### Question:
Bind extends PGMessage { public static Bind loadFromPacket(byte[] packet) { PGProto proto = new PGProto(packet, 5); Bind bind = new Bind(); bind.setPortal(proto.readNullStr()); bind.setStatement(proto.readNullStr()); int paramFormatIdCount = proto.readInt16(); int[] paramFormatIds = new int[paramFormatIdCount]; for (int i = 0; i < paramFormatIdCount; i++) { paramFormatIds[i] = proto.readInt16(); } bind.setParamFormatIds(paramFormatIds); int paramCount = proto.readInt16(); Param[] params = new Param[paramCount]; for (int i = 0; i < paramCount; i++) { Param param = new Param(); int paramLen = proto.readInt32(); if (paramLen >= 0) { param.setParamVals(proto.readBytes(paramLen)); } params[i] = param; } bind.setParams(params); int resultFormatCount = proto.readInt16(); int[] resultFormatVals = new int[resultFormatCount]; for (int i = 0; i < resultFormatCount; i++) { resultFormatVals[i] = proto.readInt16(); } bind.setResultFormat(new ResultFormat(resultFormatVals)); return bind; }  String getPortal(); void setPortal(String portal); String getStatement(); void setStatement(String statement); int[] getParamFormatIds(); void setParamFormatIds(int[] paramFormatIds); int getParamFormatIdCount(); Param[] getParams(); void setParams(Param[] params); int getParamCount(); ResultFormat getResultFormat(); void setResultFormat(ResultFormat resultFormat); static Bind loadFromPacket(byte[] packet); @Override String toString();  }### Answer:
@Test public void testLoadFromPacket() { String portal = ""; String statement = "py:0x103d9a9b0"; int[] paramFormatIds = new int[] {}; Param[] params = new Param[] {}; int[] resultFormatVals = new int[] {0, 0, 0, 1}; ResultFormat format = new ResultFormat(resultFormatVals); Bind bind = new Bind(); bind.setPortal(portal); bind.setStatement(statement); bind.setParamFormatIds(paramFormatIds); bind.setParams(params); bind.setResultFormat(format); byte[] bindBytes = bind.toPacket(); Bind newBind = Bind.loadFromPacket(bindBytes); assertEquals(newBind.toPacket(), bindBytes); assertEquals(newBind.getPortal(), bind.getPortal()); assertEquals(newBind.getStatement(), bind.getStatement()); assertEquals(newBind.getParamFormatIdCount(), bind.getParamFormatIdCount()); assertEquals(newBind.getParamFormatIds(), bind.getParamFormatIds()); assertEquals(newBind.getParamCount(), bind.getParamCount()); Param[] newParams = newBind.getParams(); Param[] expectedParams = bind.getParams(); for (int i = 0; i < expectedParams.length; i++) { assertEquals(newParams[i].getParamLen(), expectedParams[i].getParamLen()); assertEquals(newParams[i].getParamVals(), expectedParams[i].getParamVals()); } ResultFormat newFormat = newBind.getResultFormat(); assertEquals(newFormat.getResultFormatCount(), format.getResultFormatCount()); assertEquals(newFormat.getResultFormatVals(), format.getResultFormatVals()); }