EndpointBuilder endpointBuilder = mock(EndpointBuilder.class);
when(endpointBuilder.buildOutboundEndpoint()).thenReturn(prototypeEndpoint);
when(endpointBuilder.clone()).thenReturn(staticEndpointBuilder);
DynamicOutboundEndpoint dynamicOutboundEndpoint = new DynamicOutboundEndpoint(endpointBuilder, new DynamicURIBuilder(new URIBuilder("test://localhost:#[header:port]", muleContext)));
testOutboundEvent = createTestOutboundEvent();
dynamicOutboundEndpoint.process(testOutboundEvent);
dynamicOutboundEndpoint.process(testOutboundEvent);
verify(endpointBuilder, times(1)).buildOutboundEndpoint();
}