Skip to content

Instantly share code, notes, and snippets.

@tonycosentini
Created April 18, 2017 21:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tonycosentini/d22f05431af34123ef725a5d4cf08e59 to your computer and use it in GitHub Desktop.
Save tonycosentini/d22f05431af34123ef725a5d4cf08e59 to your computer and use it in GitHub Desktop.
Retrofit bug
public class RxJava {
public static void main(String[] args) {
Retrofit retrofit = new Retrofit.Builder()
.baseUrl("https://google.com/")
.addCallAdapterFactory(RxJavaCallAdapterFactory.createAsync())
.build();
Service service = retrofit.create(Service.class);
Subscription subscription = service.dummyApiCall()
.toSingle()
.subscribe(new Observer<Response<Void>>() {
@Override
public void onCompleted() {
System.out.println("Complete");
}
@Override
public void onError(Throwable throwable) {
throwable.printStackTrace();
}
@Override
public void onNext(Response<Void> voidResponse) {
System.out.println(voidResponse.code());
}
});
}
public interface Service {
@GET("/")
Observable<Response<Void>> dummyApiCall();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment