1 4 package com.tc.util.io; 5 6 import java.io.IOException ; 7 import java.nio.channels.Channel ; 8 import java.nio.channels.ClosedChannelException ; 9 10 public class MockChannel implements Channel { 11 12 private boolean isOpen = true; 13 14 public final synchronized boolean isOpen() { 15 return isOpen; 16 } 17 18 public final synchronized void close() { 19 isOpen = false; 20 } 21 22 protected final synchronized void checkOpen() throws IOException { 23 if (!isOpen()) { throw new ClosedChannelException (); } 24 } 25 } 26 | Popular Tags |