GraphTraversalSource implements TraversalSource { @Override public void close() throws Exception { if (connection != null) connection.close(); } GraphTraversalSource(final Graph graph, final TraversalStrategies traversalStrategies);  GraphTraversalSource(final Graph graph);  GraphTraversalSource(final RemoteConnection connection); @Override Optional<Class> getAnonymousTraversalClass(); @Override TraversalStrategies getStrategies(); @Override Graph getGraph(); @Override Bytecode getBytecode(); @SuppressWarnings("CloneDoesntDeclareCloneNotSupportedException") GraphTraversalSource clone(); @Override GraphTraversalSource with(final String key); @Override GraphTraversalSource with(final String key, final Object value); @Override GraphTraversalSource withStrategies(final TraversalStrategy... traversalStrategies); @Override @SuppressWarnings({"unchecked"}) GraphTraversalSource withoutStrategies(final Class<? extends TraversalStrategy>... traversalStrategyClasses); @Override GraphTraversalSource withComputer(final Computer computer); @Override GraphTraversalSource withComputer(final Class<? extends GraphComputer> graphComputerClass); @Override GraphTraversalSource withComputer(); @Override GraphTraversalSource withSideEffect(final String key, final Supplier<A> initialValue, final BinaryOperator<A> reducer); @Override GraphTraversalSource withSideEffect(final String key, final A initialValue, final BinaryOperator<A> reducer); @Override GraphTraversalSource withSideEffect(final String key, final A initialValue); @Override GraphTraversalSource withSideEffect(final String key, final Supplier<A> initialValue); @Override GraphTraversalSource withSack(final Supplier<A> initialValue, final UnaryOperator<A> splitOperator, final BinaryOperator<A> mergeOperator); @Override GraphTraversalSource withSack(final A initialValue, final UnaryOperator<A> splitOperator, final BinaryOperator<A> mergeOperator); @Override GraphTraversalSource withSack(final A initialValue); @Override GraphTraversalSource withSack(final Supplier<A> initialValue); @Override GraphTraversalSource withSack(final Supplier<A> initialValue, final UnaryOperator<A> splitOperator); @Override GraphTraversalSource withSack(final A initialValue, final UnaryOperator<A> splitOperator); @Override GraphTraversalSource withSack(final Supplier<A> initialValue, final BinaryOperator<A> mergeOperator); @Override GraphTraversalSource withSack(final A initialValue, final BinaryOperator<A> mergeOperator); GraphTraversalSource withBulk(final boolean useBulk); GraphTraversalSource withPath(); GraphTraversal<Vertex, Vertex> addV(final String label); GraphTraversal<Vertex, Vertex> addV(final Traversal<?, String> vertexLabelTraversal); GraphTraversal<Vertex, Vertex> addV(); GraphTraversal<Edge, Edge> addE(final String label); GraphTraversal<Edge, Edge> addE(final Traversal<?, String> edgeLabelTraversal); GraphTraversal<S, S> inject(S... starts); GraphTraversal<Vertex, Vertex> V(final Object... vertexIds); GraphTraversal<Edge, Edge> E(final Object... edgesIds); GraphTraversal<S, S> io(final String file); Transaction tx(); @Override void close(); @Override String toString();  }
@Test public void shouldCloseRemoteConnectionOnWithRemote() throws Exception { final RemoteConnection mock = mock(RemoteConnection.class); final GraphTraversalSource g = traversal().withRemote(mock); g.close(); verify(mock, times(1)).close(); }