Fix tests after backport of #44055

This commit is contained in:
Yannick Welsch 2019-08-06 14:18:16 +02:00
parent b3076adae6
commit 17846212bd
2 changed files with 4 additions and 1 deletions

View File

@ -68,7 +68,9 @@ public class EventHandlerTests extends ESTestCase {
SocketChannel rawChannel = mock(SocketChannel.class); SocketChannel rawChannel = mock(SocketChannel.class);
when(rawChannel.finishConnect()).thenReturn(true); when(rawChannel.finishConnect()).thenReturn(true);
NioSocketChannel channel = new NioSocketChannel(rawChannel); NioSocketChannel channel = new NioSocketChannel(rawChannel);
when(rawChannel.socket()).thenReturn(mock(Socket.class)); Socket socket = mock(Socket.class);
when(rawChannel.socket()).thenReturn(socket);
when(socket.getChannel()).thenReturn(rawChannel);
context = new DoNotRegisterSocketContext(channel, selector, channelExceptionHandler, readWriteHandler); context = new DoNotRegisterSocketContext(channel, selector, channelExceptionHandler, readWriteHandler);
channel.setContext(context); channel.setContext(context);
handler.handleRegistration(context); handler.handleRegistration(context);

View File

@ -85,6 +85,7 @@ public class SocketChannelContextTests extends ESTestCase {
}); });
rawSocket = mock(Socket.class); rawSocket = mock(Socket.class);
when(rawChannel.socket()).thenReturn(rawSocket); when(rawChannel.socket()).thenReturn(rawSocket);
when(rawSocket.getChannel()).thenReturn(rawChannel);
} }
public void testIOExceptionSetIfEncountered() throws IOException { public void testIOExceptionSetIfEncountered() throws IOException {