alec
05/15/2020, 2:03 PMdimsuz
05/17/2020, 11:44 PMjw
05/17/2020, 11:52 PMdimsuz
05/18/2020, 12:08 AMjw
05/18/2020, 12:19 AMdimsuz
05/18/2020, 12:25 AMMarco Righini
05/18/2020, 2:28 PMokhttp 4.7.0 addInsecureHost
// clientBuilder: OkHttpClient.Builder
...
val clientCertificates = HandshakeCertificates.Builder()
.addPlatformTrustedCertificates()
.addInsecureHost(proxyHost)
.build()
clientBuilder.proxy(Proxy(Proxy.Type.HTTP, InetSocketAddress.createUnresolved(proxyHost, proxyPort)))
clientBuilder.sslSocketFactory(clientCertificates.sslSocketFactory(), clientCertificates.trustManager)
clientBuilder.hostnameVerifier(HostnameVerifier { _, _ -> true })
...
but failing with
Caused by: java.security.cert.CertificateException: java.lang.RuntimeException: java.lang.IllegalArgumentException: Expected receiver of type <http://android.security.net|android.security.net>.config.RootTrustManager, but got okhttp3.tls.internal.InsecureAndroidTrustManager
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@16089023@16.0.89 (040800-239467275):9)
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.NativeCrypto.SSL_do_handshake(Native Method)
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.NativeSsl.doHandshake(:com.google.android.gms@16089023@16.0.89 (040800-239467275):7)
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.ConscryptFileDescriptorSocket.startHandshake(:com.google.android.gms@16089023@16.0.89 (040800-239467275):14)
... 58 more
Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Expected receiver of type <http://android.security.net|android.security.net>.config.RootTrustManager, but got okhttp3.tls.internal.InsecureAndroidTrustManager
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.Platform.checkTrusted(:com.google.android.gms@16089023@16.0.89 (040800-239467275):3)
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.Platform.checkServerTrusted(:com.google.android.gms@16089023@16.0.89 (040800-239467275):3)
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.ConscryptFileDescriptorSocket.verifyCertificateChain(:com.google.android.gms@16089023@16.0.89 (040800-239467275):12)
... 61 more
Caused by: java.lang.IllegalArgumentException: Expected receiver of type <http://android.security.net|android.security.net>.config.RootTrustManager, but got okhttp3.tls.internal.InsecureAndroidTrustManager
at java.lang.reflect.Method.invoke(Native Method)
at okhttp3.tls.internal.InsecureAndroidTrustManager.checkServerTrusted(InsecureAndroidTrustManager.kt:48)
at java.lang.reflect.Method.invoke(Native Method)
at <http://com.google.android.gms.org|com.google.android.gms.org>.conscrypt.Platform.checkTrusted(:com.google.android.gms@16089023@16.0.89 (040800-239467275):2)
... 63 more
Am I missing something from the doc?Ben Tseytlin
05/20/2020, 3:46 PMJoan Colmenero
05/20/2020, 5:13 PMprivate val mockWebServer = MockWebServer()
@JvmStatic
@BeforeClass
fun classSetUp() {
startMockWebServer()
mockWebServer.url("<http://localhost:58919/>")
}
@JvmStatic
@AfterClass
fun classTearDown() {
stopMockWebServer()
}
private fun startMockWebServer() {
mockWebServer.start(49331)
}
private fun stopMockWebServer() {
mockWebServer.close()
}
fun setDispatcher(dispatcher: Dispatcher) {
mockWebServer.dispatcher(dispatcher)
}
And the dispatcher that I send is :
private val dispatcher: Dispatcher = object : Dispatcher() {
@Throws(InterruptedException::class)
override fun dispatch(request: RecordedRequest): MockResponse {
if (request.path == "endpoint") {
return MockResponse()
.setResponseCode(200).setBody(
'''myjson'''
)
)
}
return MockResponse().setResponseCode(404)
}
}
Am I missing something?
And this is my fake retrofit for testing purposes
@Provides
@Singleton
fun provideTestRetrofit(httpClient: OkHttpClient): Retrofit =
Retrofit.Builder()
.baseUrl("<http://localhost:49331/>")
.client(httpClient)
.addConverterFactory(GsonConverterFactory.create())
.build()
Joan Colmenero
05/20/2020, 8:27 PMjw
05/20/2020, 9:00 PMJoan Colmenero
05/20/2020, 9:30 PMJoan Colmenero
05/21/2020, 8:14 AMmockWebServer.url("/")
it says NetworkOnMainException... I'm trying to do it with a provider of Dagger and then using it, but it says the same...Sam Garfinkel
05/23/2020, 7:23 PMImmutableKmFunction
or ImmutableKmConstructor
given a particular ExecutableElement
?egorand
05/24/2020, 6:32 PMTypeElement
first, since @Metadata
annotation is only present on the type declarationbasher
05/26/2020, 8:54 PMjw
05/26/2020, 8:54 PMbasher
05/26/2020, 8:56 PMbasher
05/26/2020, 8:57 PMbasher
05/26/2020, 8:59 PMjw
05/26/2020, 11:12 PMbasher
05/26/2020, 11:27 PMbasher
05/26/2020, 11:29 PMbasher
05/26/2020, 11:29 PMdatabase("prod") {
// config
database("dev") {
// config
}
}
basher
05/26/2020, 11:29 PMjw
05/26/2020, 11:32 PMbasher
05/26/2020, 11:42 PMjw
05/27/2020, 12:24 AMjw
05/27/2020, 12:27 AMsqldelight {
prod {
sourceSet = files("src/prod/sqldelight")
}
dev {
sourceSet = files("src/prod/sqldelight", "src/dev/sqldelight")
}
}
jw
05/27/2020, 12:28 AM