I have read when we check the image from viewfinder, we can set the aperture, shutter speed and ISO based on the light coming through the shutter.

But, only when we click the shutter release is the image captured, when shutter opens and shuts for the decided "speed".

How can the camera meter when the shutter is actually shut?

I must be missing something. 
Can anyone please clarify?