Fix unit test error.

Before the fix, there were 6 errors such as :
error => non-canonical ReadCompactSize(): unspecified iostream_category error
serialize_tests.cpp:77: error in "noncanonical": incorrect exception std::ios_base::failure is caught

After the fix, unit test passed.