@@ -0,0 +1,1843 @@
+package com.checkers.kingme.comp474checkers.network.kmp;%0A%0Aimport java.io.*;%0Aimport java.util.Arrays;%0A%0A/**%0A * Created by alshaymaaalhazzaa on 3/30/15.%0A */%0A%0Apublic class KMPChallenge extends BaseKMPPacket%0A%7B%0A    public static final byte OPCODE = CHGop;%0A    private byte%5B%5D playerName;%0A%0A    public KMPChallenge(int msgid, String playerName)%0A    %7B%0A        super(OPCODE, msgid);%0A        if(playerName.length() %3E 20) %7B%0A            playerName = playerName.substring(0, 20);%0A        %7D%0A        this.playerName = playerName.getBytes();%0A    %7D%0A%0A    // constructor to build a packet incoming from the network%0A    public KMPChallenge(byte%5B%5D buffer, int length) throws IOException%0A    %7B%0A        byte bufopcode;%0A        short bufmsgid;%0A        byte%5B%5D bufPName = new byte%5B20%5D;%0A%0A        ByteArrayInputStream bais = new ByteArrayInputStream(Arrays.copyOf(buffer, length));%0A        DataInputStream dis = new DataInputStream(bais);%0A        bufopcode = dis.readByte();%0A        bufmsgid = dis.readShort();%0A        if (bufopcode != OPCODE) %7B%0A            throw new IOException(%22Wrong opcode!%22);%0A        %7D%0A        if (dis.read(bufPName) == 0) %7B%0A            throw new IOException(%22Player name empty!%22);%0A        %7D%0A%0A        this.opcode = bufopcode;%0A        this.msgid = bufmsgid;%0A        this.playerName = bufPName;%0A    %7D%0A%0A    public byte%5B%5D write() throws IOException%0A    %7B%0A        ByteArrayOutputStream baos = new ByteArrayOutputStream(size());%0A        DataOutputStream dos = new DataOutputStream(baos);%0A        dos.writeByte(this.opcode);%0A        dos.writeShort(this.msgid);%0A        dos.write(this.playerName);%0A%0A        return baos.toByteArray();%0A    %7D%0A%0A    public int size()%0A    %7B%0A        return super.size() + this.playerName.length;%0A    %7D%0A%0A    // to get the player name as a string%0A    public String playerName()%0A    %7B%0A        return new String(playerName);%0A    %7D%0A%0A%7D%0A%0A%0A

Create KMPChallenge.java