@@ -90,7 +90,7 @@ void login(
9090
9191 @ RequestLine ("POST /" ) Observable <Response > observableResponse ();
9292
93- @ dagger .Module (overrides = true , library = true )
93+ @ dagger .Module (library = true )
9494 static class Module {
9595 @ Provides (type = SET ) Encoder defaultEncoder () {
9696 return new Encoder .Text <Object >() {
@@ -108,14 +108,6 @@ static class Module {
108108 };
109109 }
110110
111- // just run synchronously
112- @ Provides @ Singleton @ Named ("http" ) Executor httpExecutor () {
113- return new Executor () {
114- @ Override public void execute (Runnable command ) {
115- command .run ();
116- }
117- };
118- }
119111 }
120112 }
121113
@@ -126,7 +118,8 @@ public void observableVoid() throws IOException, InterruptedException {
126118 server .play ();
127119
128120 try {
129- TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (), new TestInterface .Module ());
121+ TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
122+ new TestInterface .Module (), new RunSynchronous ());
130123
131124 final AtomicBoolean success = new AtomicBoolean ();
132125
@@ -160,7 +153,8 @@ public void observableResponse() throws IOException, InterruptedException {
160153 server .play ();
161154
162155 try {
163- TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (), new TestInterface .Module ());
156+ TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
157+ new TestInterface .Module (), new RunSynchronous ());
164158
165159 final AtomicBoolean success = new AtomicBoolean ();
166160
@@ -187,14 +181,26 @@ public void observableResponse() throws IOException, InterruptedException {
187181 }
188182 }
189183
184+ @ Module (library = true , overrides = true )
185+ static class RunSynchronous {
186+ @ Provides @ Singleton @ Named ("http" ) Executor httpExecutor () {
187+ return new Executor () {
188+ @ Override public void execute (Runnable command ) {
189+ command .run ();
190+ }
191+ };
192+ }
193+ }
194+
190195 @ Test
191196 public void incrementString () throws IOException , InterruptedException {
192197 final MockWebServer server = new MockWebServer ();
193198 server .enqueue (new MockResponse ().setResponseCode (200 ).setBody ("foo" ));
194199 server .play ();
195200
196201 try {
197- TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (), new TestInterface .Module ());
202+ TestInterface api = Feign .create (TestInterface .class , "http://localhost:" + server .getPort (),
203+ new TestInterface .Module (), new RunSynchronous ());
198204
199205 final AtomicBoolean success = new AtomicBoolean ();
200206
0 commit comments