Preserve an active domain on I/O in native bindings

Native binding didn't preserve an active domain on I/O because of native connection didn't handle it. I've provided a fix with two test cases.