Observable.compose Generics

Manual merge of https://github.com/ReactiveX/RxJava/pull/1762 with extra unit tests added.