Skip to content

Commit

Permalink
Merge branch 'master' into dependabot/gradle/junitJupiterVersion-5.10.1
Browse files Browse the repository at this point in the history
  • Loading branch information
ybelMekk authored Nov 6, 2023
2 parents da63e30 + f90b563 commit 7f8d247
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ MockWebServerWrapper
val ssl: Ssl? = null,
) : OAuth2HttpServer {
val mockWebServer: MockWebServer = MockWebServer()
private var address: InetAddress? = null

override fun start(
inetAddress: InetAddress,
Expand All @@ -90,6 +91,7 @@ MockWebServerWrapper
if (ssl != null) {
mockWebServer.useHttps(ssl.sslContext().socketFactory, false)
}
this.address = inetAddress
log.debug("started server on address=$inetAddress and port=${mockWebServer.port}, httpsEnabled=${ssl != null}")
}

Expand All @@ -100,7 +102,11 @@ MockWebServerWrapper

override fun port(): Int = mockWebServer.port

override fun url(path: String): HttpUrl = mockWebServer.url(path)
override fun url(path: String): HttpUrl = mockWebServer
.url(path)
.newBuilder()
.host(address?.hostName ?: mockWebServer.hostName)
.build()

override fun sslConfig(): Ssl? = ssl

Expand Down Expand Up @@ -189,7 +195,7 @@ class NettyWrapper
}
return HttpUrl.Builder()
.scheme(scheme)
.host(address.address.canonicalHostName)
.host(address.address.hostName)
.port(port())
.build()
.resolve(path)!!
Expand Down

0 comments on commit 7f8d247

Please sign in to comment.