packet = (Packet)queue.elementAt(0);
packet = queue.elementAt(0);
        public synchronized Packet getPacket() {            Packet packet = null;            while (!hasPending() && !finished) {                try {                    wait();                } catch (InterruptedException ex) {                }            }            if (!finished) {                packet = (Packet)queue.elementAt(0);                queue.removeElementAt(0);            }            return packet;        }