@Test
public void getInstancesShouldBeAbleToHandleEndpointsSingleAddressAndMultiplePorts() {

	Map<String, String> labels = new HashMap();
	labels.put("l2", "v2");
	Endpoints endPoint1 = new EndpointsBuilder().withNewMetadata().withName("endpoint").withNamespace("test")
			.withLabels(labels).endMetadata().addNewSubset().addNewAddress().withIp("ip1").withNewTargetRef()
			.withUid("20").endTargetRef().endAddress().addNewPort("mgmt", "mgmt_tcp", 900, "TCP")
			.addNewPort("http", "http_tcp", 80, "TCP").endSubset().build();
	List<Endpoints> endpointsList = new ArrayList<>();
	endpointsList.add(endPoint1);
	EndpointsList endpoints = new EndpointsList();
	endpoints.setItems(endpointsList);
	mockServer.expect().get().withPath(
			"/api/v1/namespaces/test/endpoints?labelSelector=l2%3Dv2&fieldSelector=metadata.name%3Dendpoint")
			.andReturn(200, endpoints).once();
	mockServer.expect().get().withPath("/api/v1/namespaces/test/endpoints?fieldSelector=metadata.name%3Dendpoint")
			.andReturn(200, endpoints).once();
	Service service = new ServiceBuilder().withNewMetadata().withName("endpoint").withNamespace("test")
			.withLabels(labels).withAnnotations(labels).endMetadata().build();
	mockServer.expect().get().withPath("/api/v1/namespaces/test/services/endpoint").andReturn(200, service)
			.always();
	final KubernetesDiscoveryProperties properties = new KubernetesDiscoveryProperties();
	properties.setPrimaryPortName("http_tcp");
	final DiscoveryClient discoveryClient = new KubernetesDiscoveryClient(mockClient, properties,
			KubernetesClient::services, new DefaultIsServicePortSecureResolver(properties));
	final List<ServiceInstance> instances = discoveryClient.getInstances("endpoint");
	assertThat(instances).hasSize(1).filteredOn(s -> s.getHost().equals("ip1") && !s.isSecure()).hasSize(1)
			.filteredOn(s -> s.getInstanceId().equals("20")).hasSize(1).filteredOn(s -> 80 == s.getPort())
			.hasSize(1);
}