public final URLConnectionSender build() { if (encoding() == Encoding.JSON) { return mediaType("application/json").encoder(BytesMessageEncoder.JSON).autoBuild(); } else if (encoding() == Encoding.THRIFT) { return mediaType("application/x-thrift").encoder(BytesMessageEncoder.THRIFT).autoBuild(); } throw new UnsupportedOperationException("Unsupported encoding: " + encoding().name()); }
/** Creates a sender that posts {@link Encoding#JSON} messages. */ public static URLConnectionSender json(String endpoint) { return builder().encoding(Encoding.JSON).endpoint(endpoint).build(); }