Skip to content

Commit

Permalink
Only perform case conversion of hostnames on windows
Browse files Browse the repository at this point in the history
Issues: IN-565
  • Loading branch information
Michel Hartmann committed Dec 12, 2023
1 parent 93e0987 commit 315e6db
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,10 +81,10 @@ public void testCustomize() throws UnknownHostException

Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName());
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName().toLowerCase());
rq.customize(e, request);
if (PlatformUtil.isWindows())
{
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName().toLowerCase());
rq.customize(e, request);
Mockito.when(request.getServerName()).thenReturn(InetAddress.getLocalHost().getHostName().toUpperCase());
rq.customize(e, request);
}
Expand All @@ -96,7 +96,7 @@ public void testCustomize() throws UnknownHostException
}

@Test
public void testCustomizeBad() throws UnknownHostException
public void testCustomizeBad()
{
BambiRequestCustomizer rq = new BambiRequestCustomizer();
SSLEngine e = Mockito.mock(SSLEngine.class);
Expand All @@ -107,9 +107,7 @@ public void testCustomizeBad() throws UnknownHostException

Mockito.when(request.getServerName()).thenReturn("notMyHost");

assertThrows(BadMessageException.class, () -> {
rq.customize(e, request);
});
assertThrows(BadMessageException.class, () -> rq.customize(e, request));
}

}

0 comments on commit 315e6db

Please sign in to comment.