      */
     public function closeStreamingConnection():void
     {
+        resetParserState();
+        
     	// First, close the existing connection.
         if (streamingConnection != null)
         {

     *  The server-assigned id for the streaming connection.
     */
    protected var streamId:String;

    /**
     *  Storage for the hex-format chunk size value from the byte stream.

            result += digit * powerOfSixteen;
        }
        return result;
    }
    
    /**
     *  Helper method to reset parser to initial state.
     */
    private function resetParserState():void
    {
        state = INIT_STATE;
        chunkBuffer = null;
        hexChunkSize = null;
        dataBytesToRead = -1;
        dataOffset = 0;        
    }

    /**
