Getting error symbol not found for RealConnection.noNewExchanges() in custom interceptor

Viewed 32

I am writing my own custom interceptor using okhttp3 and I need to access the RealConnection noNewExchanges function but getting the following error:

error: cannot find symbol
                realConnection.noNewExchanges();
                              ^
  symbol:   method noNewExchanges()
  location: variable realConnection of type RealConnection

I have placed the interceptor in the same package path as the RealConnection (okhttp3.internal.connection)

1 Answers

RealConnection is in the okhttp3.internal.connection package which means it is not stable API, and you should consider it likely to break any time you update versions. You should not use this API and look for other approaches instead.

But since you are calling from java, the var noNewExchanges = false is accessible as a java style getter and setter.

realConnection.getNoNewExchanges()

Related