I am using LittleProxy which implements Netty . I am trying to return the IP address and port of the source of an HTTP request. I use the getRemoteAddress method, but the returned port is always different. It seems to add up after every request? I must be missing some insight here.
After some searching, I tried downcasting it to an InetSocketAddress. But the results are the same:
private void processRequest(final ChannelHandlerContext ctx,
final MessageEvent me) {
final HttpRequest request = (HttpRequest) me.getMessage();
//THOMAS EDIT FOR OUTPUT REMOTE ID AND PORT
InetSocketAddress inetAddr = (InetSocketAddress)me.getRemoteAddress();
System.out.println("Source IP: " + inetAddr.getAddress());
System.out.println("Source Port: " + inetAddr.getPort());