@Override
public <R extends HttpRequest> R bindToRequest(R request, Object input) {
checkArgument(checkNotNull(input, "input is null") instanceof IpPortPair,
"this binder is only valid for a IpPortPair argument");
IpPortPair ipPortPair = (IpPortPair) input;
checkNotNull(ipPortPair.getIp(), "There must be an IP address defined");
checkNotNull(ipPortPair.getIp().getIp(), "There must be an IP address defined in Ip object");
checkState(ipPortPair.getPort() > 0, "The port number must be a positive integer");
ImmutableMultimap.Builder<String, String> builder = ImmutableMultimap.<String, String> builder();
builder.put(VIRTUAL_IP_KEY + "ip", ipPortPair.getIp().getIp());
builder.put(VIRTUAL_IP_KEY + "port", String.valueOf(ipPortPair.getPort()));
return (R) request.toBuilder().replaceQueryParams(builder.build()).build();
}