@Test public void testRemoteAddress() throws Exception { ChannelHandlerContext ctx = mock(ChannelHandlerContext.class); Channel channel = mock(Channel.class); when(ctx.channel()).thenReturn(channel); InetSocketAddress address = new InetSocketAddress("1.2.3.4", 1234); when(channel.remoteAddress()).thenReturn(address); HttpRequest req = new DefaultFullHttpRequest(HttpVersion.HTTP_1_1, HttpMethod.GET, "/"); req.headers().add(HeaderNames.X_FORWARD_FOR, "localhost"); RequestFromVertx request = new RequestFromVertx(create(req)); assertThat(request.remoteAddress()).isEqualTo("localhost"); }
@Override public String remoteAddress() { if (headers().containsKey(HeaderNames.X_FORWARD_FOR)) { return getHeader(HeaderNames.X_FORWARD_FOR); } else { return host(); } }
RequestFromVertx extends Request { @Override public String remoteAddress() { if (headers().containsKey(HeaderNames.X_FORWARD_FOR)) { return getHeader(HeaderNames.X_FORWARD_FOR); } else { return host(); } } }
RequestFromVertx extends Request { @Override public String remoteAddress() { if (headers().containsKey(HeaderNames.X_FORWARD_FOR)) { return getHeader(HeaderNames.X_FORWARD_FOR); } else { return host(); } } RequestFromVertx(final HttpServerRequest request); }
RequestFromVertx extends Request { @Override public String remoteAddress() { if (headers().containsKey(HeaderNames.X_FORWARD_FOR)) { return getHeader(HeaderNames.X_FORWARD_FOR); } else { return host(); } } RequestFromVertx(final HttpServerRequest request); @Override String contentType(); @Override String encoding(); @Override String language(); @Override String charset(); @Override String uri(); @Override String method(); @Override String remoteAddress(); @Override String host(); @Override String path(); @Override MediaType mediaType(); @Override Collection<MediaType> mediaTypes(); @Override boolean accepts(String mimeType); @Override Cookies cookies(); Cookie cookie(String name); @Override Map<String, List<String>> headers(); @Override String parameter(String name); @Override List<String> parameterMultipleValues(String name); @Override String parameter(String name, String defaultValue); @Override Integer parameterAsInteger(String name); @Override Integer parameterAsInteger(String name, Integer defaultValue); @Override Boolean parameterAsBoolean(String name); @Override Boolean parameterAsBoolean(String name, boolean defaultValue); @Override Map<String, List<String>> parameters(); @Override Map<String, Object> data(); HttpServerRequest getVertxRequest(); Map<String, List<String>> getFormData(); String getRawBodyAsString(); byte[] getRawBody(); List<VertxFileUpload> getFiles(); boolean ready(); }
RequestFromVertx extends Request { @Override public String remoteAddress() { if (headers().containsKey(HeaderNames.X_FORWARD_FOR)) { return getHeader(HeaderNames.X_FORWARD_FOR); } else { return host(); } } RequestFromVertx(final HttpServerRequest request); @Override String contentType(); @Override String encoding(); @Override String language(); @Override String charset(); @Override String uri(); @Override String method(); @Override String remoteAddress(); @Override String host(); @Override String path(); @Override MediaType mediaType(); @Override Collection<MediaType> mediaTypes(); @Override boolean accepts(String mimeType); @Override Cookies cookies(); Cookie cookie(String name); @Override Map<String, List<String>> headers(); @Override String parameter(String name); @Override List<String> parameterMultipleValues(String name); @Override String parameter(String name, String defaultValue); @Override Integer parameterAsInteger(String name); @Override Integer parameterAsInteger(String name, Integer defaultValue); @Override Boolean parameterAsBoolean(String name); @Override Boolean parameterAsBoolean(String name, boolean defaultValue); @Override Map<String, List<String>> parameters(); @Override Map<String, Object> data(); HttpServerRequest getVertxRequest(); Map<String, List<String>> getFormData(); String getRawBodyAsString(); byte[] getRawBody(); List<VertxFileUpload> getFiles(); boolean ready();  }