use of org.janusgraph.diskstorage.cassandra.thrift.thriftpool.CTConnectionFactory in project janusgraph by JanusGraph.
the class ThriftConnectionTest method testConnectionDropped.
@Test
public void testConnectionDropped() throws Exception {
CTConnectionFactory connectionFactory = spy(factoryConfig.build());
CTConnection mockConnection = spy(connectionFactory.makeObject("janusgraph"));
when(mockConnection.getConfig()).thenReturn(factoryConfig);
when(mockConnection.isOpen()).thenReturn(true);
TTransport mockClient = spy(mockConnection.getTransport());
assertTrue(connectionFactory.validateObject(null, mockConnection));
when(mockClient.readAll(new byte[0], 0, 0)).thenThrow(new TTransportException("Broken Pipe"));
assertTrue(mockClient.isOpen());
}
Aggregations