@Override
      public Endpoint fromJson(JsonReader reader) throws IOException {
        reader.beginObject();
        String serviceName = null, ipv4 = null, ipv6 = null;
        int port = 0;
        while (reader.hasNext()) {
          String nextName = reader.nextName();
          if (reader.peek() == JsonReader.Token.NULL) {
            reader.skipValue();
            continue;
          }
          switch (nextName) {
            case "serviceName":
              serviceName = reader.nextString();
              break;
            case "ipv4":
              ipv4 = reader.nextString();
              break;
            case "ipv6":
              ipv6 = reader.nextString();
              break;
            case "port":
              port = reader.nextInt();
              break;
            default:
              reader.skipValue();
          }
        }
        reader.endObject();
        if (serviceName == null && ipv4 == null && ipv6 == null && port == 0) return null;
        return Endpoint.newBuilder()
          .serviceName(serviceName)
          .ip(ipv4)
          .ip(ipv6)
          .port(port)
          .build();
      }
Read-only json adapters resurrected from before we switched to Java 6 as storage components can
be Java 7+
benchmarks/src/test/java/zipkin2/codec/MoshiSpanDecoder.java