private void updateChunk() throws IOException{
            if(!firstChunk){ // if this is not the first chunk, skip over the CRLF
                int r = in.read();
                int n = in.read();
                if(r != '\r' || n != '\n'){
                    throw new IOException("Invalid chunked encoding");
                }
            }
            firstChunk = false;
            
            String[] chunkHeader = getChunkHeader();
            chunkRemaining = Integer.parseInt(chunkHeader[0], 16);
            if(chunkRemaining == 0){
                byte[] bytesLeft = getHeaders(in, new ArrayList());
                if(bytesLeft.length > 0){
                    throw new IOException("Invalid chunked encoding");
                }
                if(in.left.length > in.alreadyRead){
                    throw new IOException("Invalid chunked encoding");
                }
                chunkRemaining = -1;
            }
        }