### Question:
ConnectionImpl extends Connection<R, W> { @Override public Observable<Void> close() { return delegate.close(); } private  ConnectionImpl(Channel nettyChannel, ConnectionEventListener eventListener, EventPublisher eventPublisher); private  ConnectionImpl(Channel nettyChannel, ChannelOperations<W> delegate); private  ConnectionImpl(ConnectionImpl<?, ?> toCopy, ContentSource<R> contentSource, ChannelOperations<W> delegate); @Override Observable<Void> write(Observable<W> msgs); @Override Observable<Void> write(Observable<W> msgs, Func1<W, Boolean> flushSelector); @Override Observable<Void> writeAndFlushOnEach(Observable<W> msgs); @Override Observable<Void> writeString(Observable<String> msgs); @Override Observable<Void> writeString(Observable<String> msgs, Func1<String, Boolean> flushSelector); @Override Observable<Void> writeStringAndFlushOnEach(Observable<String> msgs); @Override Observable<Void> writeBytes(Observable<byte[]> msgs); @Override Observable<Void> writeBytes(Observable<byte[]> msgs,
                                       Func1<byte[], Boolean> flushSelector); @Override Observable<Void> writeBytesAndFlushOnEach(Observable<byte[]> msgs); @Override Observable<Void> writeFileRegion(Observable<FileRegion> msgs); @Override Observable<Void> writeFileRegion(Observable<FileRegion> msgs,
                                            Func1<FileRegion, Boolean> flushSelector); @Override Observable<Void> writeFileRegionAndFlushOnEach(Observable<FileRegion> msgs); @Override void flush(); @Override Observable<Void> close(); @Override Observable<Void> close(boolean flush); @Override void closeNow(); @Override Observable<Void> closeListener(); static ConnectionImpl<R, W> fromChannel(Channel nettyChannel); @Override Connection<RR, WW> addChannelHandlerFirst(String name, ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerFirst(EventExecutorGroup group, String name,
                                                              ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerLast(String name, ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerLast(EventExecutorGroup group, String name,
                                                             ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerBefore(String baseName, String name, ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerBefore(EventExecutorGroup group, String baseName, String name,
                                                               ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerAfter(String baseName, String name, ChannelHandler handler); @Override Connection<RR, WW> addChannelHandlerAfter(EventExecutorGroup group, String baseName, String name,
                                                              ChannelHandler handler); @Override Connection<RR, WW> pipelineConfigurator(Action1<ChannelPipeline> pipelineConfigurator); @Override Connection<RR, W> transformRead(Transformer<R, RR> transformer); @Override Connection<R, WW> transformWrite(AllocatingTransformer<WW, W> transformer);  }### Answer:
@Test(timeout = 60000) public void testClose() throws Exception { connRule.connection.close(); Mockito.verify(connRule.channelOperations).close(); Mockito.verifyNoMoreInteractions(connRule.channelOperations); }
@Test(timeout = 60000) public void testCloseWithoutFlush() throws Exception { connRule.connection.close(false); Mockito.verify(connRule.channelOperations).close(false); Mockito.verifyNoMoreInteractions(connRule.channelOperations); }