Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 3 of 3 for decodeAnswers (0.06 sec)

  1. okhttp-dnsoverhttps/src/test/java/okhttp3/dnsoverhttps/DnsRecordCodecTest.kt

    import java.net.UnknownHostException
    import kotlin.test.assertFailsWith
    import okhttp3.dnsoverhttps.DnsRecordCodec.TYPE_A
    import okhttp3.dnsoverhttps.DnsRecordCodec.TYPE_AAAA
    import okhttp3.dnsoverhttps.DnsRecordCodec.decodeAnswers
    import okio.ByteString.Companion.decodeHex
    import org.junit.jupiter.api.Test
    
    class DnsRecordCodecTest {
      @Test
      fun testGoogleDotComEncoding() {
        val encoded = encodeQuery("google.com", TYPE_A)
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Thu May 29 20:09:10 UTC 2025
    - 3.6K bytes
    - Viewed (0)
  2. okhttp-dnsoverhttps/src/main/kotlin/okhttp3/dnsoverhttps/DnsRecordCodec.kt

            nameBuf.writeByte(0) // end
    
            nameBuf.copyTo(this, 0, nameBuf.size)
            writeShort(type)
            writeShort(1) // CLASS_IN
          }.readByteString()
    
      @Throws(Exception::class)
      fun decodeAnswers(
        hostname: String,
        byteString: ByteString,
      ): List<InetAddress> {
        val result = mutableListOf<InetAddress>()
    
        val buf = Buffer()
        buf.write(byteString)
        buf.readShort() // query id
    
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Wed Mar 19 19:25:20 UTC 2025
    - 3.9K bytes
    - Viewed (0)
  3. okhttp-dnsoverhttps/src/main/kotlin/okhttp3/dnsoverhttps/DnsOverHttps.kt

              "response size exceeds limit ($MAX_RESPONSE_SIZE bytes): ${body.contentLength()} bytes",
            )
          }
    
          val responseBytes = body.source().readByteString()
    
          return DnsRecordCodec.decodeAnswers(hostname, responseBytes)
        }
      }
    
      private fun buildRequest(
        hostname: String,
        type: Int,
      ): Request =
        Request
          .Builder()
          .header("Accept", DNS_MESSAGE.toString())
    Registered: Fri Sep 05 11:42:10 UTC 2025
    - Last Modified: Sat May 10 11:15:14 UTC 2025
    - 8.6K bytes
    - Viewed (0)
Back to top