gesterzhou commented on a change in pull request #5665:
URL: https://github.com/apache/geode/pull/5665#discussion_r512928045
##########
File path:
geode-core/src/test/java/org/apache/geode/internal/tcp/ConnectionTest.java
##########
@@ -113,4 +114,35 @@ public void connectTimeoutIsShortWhenAlerting() throws
UnknownHostException {
assertThat(connection.getP2PConnectTimeout(distributionConfig)).isEqualTo(100);
});
}
+
+ @Test
+ public void notifyHandshakeWaiterShouldPositionByteBufferOnlyOnce() throws
Exception {
+ ConnectionTable connectionTable = mock(ConnectionTable.class);
+ Distribution distribution = mock(Distribution.class);
+ DistributionManager distributionManager = mock(DistributionManager.class);
+ DMStats dmStats = mock(DMStats.class);
+ CancelCriterion stopper = mock(CancelCriterion.class);
+ SocketCloser socketCloser = mock(SocketCloser.class);
+ TCPConduit tcpConduit = mock(TCPConduit.class);
+
+ when(connectionTable.getBufferPool()).thenReturn(new BufferPool(dmStats));
+ when(connectionTable.getConduit()).thenReturn(tcpConduit);
+ when(connectionTable.getDM()).thenReturn(distributionManager);
+ when(connectionTable.getSocketCloser()).thenReturn(socketCloser);
+ when(distributionManager.getDistribution()).thenReturn(distribution);
+ when(stopper.cancelInProgress()).thenReturn(null);
+ when(tcpConduit.getCancelCriterion()).thenReturn(stopper);
+ when(tcpConduit.getDM()).thenReturn(distributionManager);
+ when(tcpConduit.getSocketId()).thenReturn(new
InetSocketAddress(getLocalHost(), 10337));
+ when(tcpConduit.getStats()).thenReturn(dmStats);
+
+ SocketChannel channel = SocketChannel.open();
+
+ Connection connection = new Connection(connectionTable, channel.socket());
+ connection = spy(connection);
+ connection.setSharedUnorderedForTest();
+ connection.run();
+
+ verify(connection, times(1)).getConduit();
Review comment:
fixed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]