Вот код, который я использую
class VerificationInterceptor(private val helper: RequestHelper) : Interceptor {
override fun intercept(chain: Interceptor.Chain): Response =
chain.proceed(chain.request()).apply {
if (code == 200
&& !chain.request().url.toString().contains(BuildConfig.root)
&& !chain.request().url.toString().contains(LOCAL_HOST_BASE)
) {
if (!helper.getResponseCryptoVerification(
headers,
peekBody(Long.MAX_VALUE).string()
)
) {
throw IOException("Error while generating Hmac for Response JSON")
}
}
}
}
Эта строка здесь chain.proceed(chain.request()).apply {
падает с этой трассировкой стека
java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect()(PlainSocketImpl.java:-2)
at java.net.AbstractPlainSocketImpl.doConnect()(AbstractPlainSocketImpl.java:334)
at java.net.AbstractPlainSocketImpl.connectToAddress()(AbstractPlainSocketImpl.java:196)
at java.net.AbstractPlainSocketImpl.connect()(AbstractPlainSocketImpl.java:178)
at java.net.SocksSocketImpl.connect()(SocksSocketImpl.java:356)
at java.net.Socket.connect()(Socket.java:605)
at okhttp3.internal.platform.AndroidPlatform.connectSocket()(AndroidPlatform.kt:58)
at okhttp3.internal.connection.RealConnection.connectSocket()(RealConnection.kt:268)
at okhttp3.internal.connection.RealConnection.connect()(RealConnection.kt:176)
at okhttp3.internal.connection.ExchangeFinder.findConnection()(ExchangeFinder.kt:236)
at okhttp3.internal.connection.ExchangeFinder.findHealthyConnection()(ExchangeFinder.kt:109)
at okhttp3.internal.connection.ExchangeFinder.find()(ExchangeFinder.kt:77)
at okhttp3.internal.connection.Transmitter.newExchange$okhttp()(Transmitter.kt:162)
at okhttp3.internal.connection.ConnectInterceptor.intercept()(ConnectInterceptor.kt:35)
at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:87)
at okhttp3.internal.cache.CacheInterceptor.intercept()(CacheInterceptor.kt:82)
at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:112)
at okhttp3.internal.http.RealInterceptorChain.proceed()(RealInterceptorChain.kt:87)
at okhttp3.internal.http.BridgeInterceptor.intercept()(BridgeInterceptor.kt:84)
Вопрос в том, что вызывает кр sh? Как отловить и продолжить цепочку запросов?