Breaking the StreamAdapter into smaller methods and ensuring that custom stream context options are merged over all other options