ERR extends Packet { public static ERR loadFromPacket(byte[] packet) { ERR obj = new ERR(); Proto proto = new Proto(packet, 3); obj.sequenceId = proto.get_fixed_int(1); proto.get_filler(1); obj.errorCode = proto.get_fixed_int(2); proto.get_filler(1); obj.sqlState = proto.get_fixed_str(5); obj.errorMessage = proto.get_eop_str(); return obj; }  ArrayList<byte[]> getPayload(); static ERR loadFromPacket(byte[] packet); public long errorCode; public String sqlState; public String errorMessage; }
@Test public void test1() { byte[] packet = Proto.packet_string_to_bytes( "17 00 00 01 ff 48 04 23 48 59 30 30 30 4e 6f 20" + "74 61 62 6c 65 73 20 75 73 65 64" ); ERR pkt = ERR.loadFromPacket(packet); assertArrayEquals(packet, pkt.toPacket()); assertEquals(pkt.errorCode, 1096); assertEquals(pkt.sqlState, "HY000"); assertEquals(pkt.errorMessage, "No tables used"); }