-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
naman.soni
committed
Aug 8, 2024
1 parent
2b08faa
commit d8ed0a3
Showing
2 changed files
with
49 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
guice/src/test/java/com/flipkart/gjex/grpc/interceptor/FilterInterceptorTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package com.flipkart.gjex.grpc.interceptor; | ||
|
||
import org.junit.Assert; | ||
import org.junit.Test; | ||
|
||
import java.net.InetSocketAddress; | ||
import java.net.SocketAddress; | ||
|
||
public class FilterInterceptorTest { | ||
private static final String IP_ADDRESS = "1.2.3.4"; | ||
|
||
@Test | ||
public void getClientIpTest(){ | ||
InetSocketAddress inetSocketAddress = new InetSocketAddress(IP_ADDRESS, 1234); | ||
Assert.assertEquals(IP_ADDRESS, FilterInterceptor.getClientIp(inetSocketAddress)); | ||
|
||
SocketAddress socketAddress = new SocketAddress() { | ||
@Override | ||
public String toString() { | ||
return IP_ADDRESS; | ||
} | ||
}; | ||
Assert.assertEquals(IP_ADDRESS, FilterInterceptor.getClientIp(socketAddress)); | ||
} | ||
|
||
} |