EndpointRequestFilter extends AbstractRequestFilter { @Override public void filterAbstractHttpRequest(SubmitContext context, AbstractHttpRequest<?> request) { HttpRequestBase httpMethod = (HttpRequestBase) context.getProperty(BaseHttpRequestTransport.HTTP_METHOD); String strURL = request.getEndpoint(); strURL = PropertyExpander.expandProperties(context, strURL); try { if (StringUtils.hasContent(strURL)) { URI uri = new URI(strURL, request.getSettings().getBoolean(HttpSettings.ENCODED_URLS)); context.setProperty(BaseHttpRequestTransport.REQUEST_URI, uri); httpMethod.setURI(HttpUtils.createUri(uri)); } } catch (Exception e) { SoapUI.logError(e); } }  @Override void filterAbstractHttpRequest(SubmitContext context, AbstractHttpRequest<?> request);  }
@Test public void doesNotDoubleEncodeAlreadyEncodedUri() throws URISyntaxException { String encodedUri = "http: HttpRequestBase httpMethod = Mockito.mock(HttpRequestBase.class); SubmitContext context = mockContext(httpMethod); AbstractHttpRequest<?> request = mockRequest(encodedUri, mockSettings()); endpointRequestFilter.filterAbstractHttpRequest(context, request); ArgumentCaptor<URI> httpMethodUri = ArgumentCaptor.forClass(URI.class); Mockito.verify(httpMethod).setURI(httpMethodUri.capture()); Assert.assertThat(httpMethodUri.getValue(), Is.is(new URI(encodedUri))); }