### Question:
HttpUtils { public static URI toAbsoluteUri(String relativePath, Message message) { String base = BaseUrlHelper.getBaseURL( (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST)); return URI.create(base + relativePath); } private  HttpUtils(); static String urlDecode(String value, String enc); static String urlDecode(String value); static String pathDecode(String value); static String queryEncode(String value); static String urlEncode(String value); static String urlEncode(String value, String enc); static String pathEncode(String value); static boolean isPartiallyEncoded(String value); static String encodePartiallyEncoded(String encoded, boolean query); static SimpleDateFormat getHttpDateFormat(); static String toHttpDate(Date date); static RuntimeDelegate getOtherRuntimeDelegate(); static HeaderDelegate<Object> getHeaderDelegate(Object o); @SuppressWarnings("unchecked") static HeaderDelegate<Object> getHeaderDelegate(RuntimeDelegate rd, Object o); @SuppressWarnings("unchecked") static MultivaluedMap<String, T> getModifiableStringHeaders(Message m); static MultivaluedMap<String, Object> getModifiableHeaders(Message m); static void convertHeaderValuesToString(Map<String, List<Object>> headers, boolean delegateOnly); static Date getHttpDate(String value); static Locale getLocale(String value); static int getContentLength(String value); static String getHeaderString(List<String> values); static boolean isDateRelatedHeader(String headerName); static boolean isHttpRequest(Message message); static URI toAbsoluteUri(String relativePath, Message message); static URI toAbsoluteUri(URI u, Message message); static void resetRequestURI(Message m, String requestURI); static String getPathToMatch(Message m, boolean addSlash); static String getProtocolHeader(Message m, String name, String defaultValue); static String getProtocolHeader(Message m, String name, String defaultValue, boolean setOnMessage); static String getBaseAddress(Message m); static String getEndpointAddress(Message m); static void updatePath(Message m, String path); static String getPathToMatch(String path, String address, boolean addSlash); static String getOriginalAddress(Message m); static String fromPathSegment(PathSegment ps); static Response.Status getParameterFailureStatus(ParameterType pType); static String getSetEncoding(MediaType mt, MultivaluedMap<String, Object> headers,
                                        String defaultEncoding); static String getEncoding(MediaType mt, String defaultEncoding); static String getMediaTypeCharsetParameter(MediaType mt); static URI resolve(UriBuilder baseBuilder, URI uri); static URI relativize(URI base, URI uri); static String toHttpLanguage(Locale locale); static boolean isPayloadEmpty(MultivaluedMap<String, String> headers); static T createServletResourceValue(Message m, Class<T> clazz); static boolean isMethodWithNoRequestContent(String method); static boolean isMethodWithNoResponseContent(String method);  }### Answer:
@Test public void testReplaceAnyIPAddress() { Message m = new MessageImpl(); HttpServletRequest req = EasyMock.createMock(HttpServletRequest.class); m.put(AbstractHTTPDestination.HTTP_REQUEST, req); req.getScheme(); EasyMock.expectLastCall().andReturn("http"); req.getServerName(); EasyMock.expectLastCall().andReturn("localhost"); req.getServerPort(); EasyMock.expectLastCall().andReturn(8080); EasyMock.replay(req); URI u = HttpUtils.toAbsoluteUri(URI.create("http: assertEquals("http: }
@Test public void testReplaceLocalHostWithPort() { Message m = new MessageImpl(); URI u = HttpUtils.toAbsoluteUri(URI.create("http: assertEquals("http: }