List of usage examples for org.apache.thrift.transport TTransport readAll
public int readAll(byte[] buf, int off, int len) throws TTransportException
From source file:org.janusgraph.graphdb.thrift.ThriftConnectionTest.java
License:Apache License
@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());/*from ww w.j av a2 s . co m*/ }