1 8 package org.codehaus.spice.netserve.connection.impl; 9 10 import java.io.IOException ; 11 import java.io.InterruptedIOException ; 12 import java.net.ServerSocket ; 13 import java.net.Socket ; 14 15 20 class ExceptOnAcceptServerSocket 21 extends ServerSocket 22 { 23 static final IOException ERROR_EXCEPTION = new IOException ( "No Accept - ha ha!" ); 24 static final IOException INTERRUPTED_EXCEPTION = new InterruptedIOException ( "No Interuptions!" ); 25 26 private boolean m_interupt; 27 28 public ExceptOnAcceptServerSocket( final boolean interupt ) 29 throws IOException 30 { 31 m_interupt = interupt; 32 } 33 34 public Socket accept() throws IOException 35 { 36 if ( m_interupt ) 37 { 38 throw INTERRUPTED_EXCEPTION; 39 } 40 else 41 { 42 throw ERROR_EXCEPTION; 43 } 44 } 45 } 46 | Popular Tags |