File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
consumer/src/main/kotlin/au/com/dius/pact/consumer Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -32,6 +32,7 @@ import io.ktor.server.response.respondBytes
32
32
import kotlinx.coroutines.CoroutineScope
33
33
import kotlinx.coroutines.Dispatchers
34
34
import kotlinx.coroutines.launch
35
+ import kotlinx.coroutines.runBlocking
35
36
import kotlinx.coroutines.withContext
36
37
import java.net.URI
37
38
import java.util.zip.DeflaterInputStream
@@ -163,14 +164,14 @@ class KTorMockServer @JvmOverloads constructor(
163
164
164
165
override fun start () {
165
166
logger.debug { " Starting mock server" }
166
-
167
- CoroutineScope (server.application.coroutineContext).launch {
168
- localAddress = server.engine.resolvedConnectors().first()
167
+ runBlocking {
168
+ val startJob = CoroutineScope (server.application.coroutineContext).launch {
169
+ localAddress = server.engine.resolvedConnectors().first()
170
+ }
171
+ server.start()
172
+ startJob.join()
173
+ logger.debug { " Mock server started: $localAddress " }
169
174
}
170
-
171
- server.start()
172
- waitForServer()
173
- logger.debug { " Mock server started: $localAddress " }
174
175
}
175
176
176
177
override fun stop () {
You can’t perform that action at this time.
0 commit comments