01: /*
02: * Copyright (C) The Spice Group. All rights reserved.
03: *
04: * This software is published under the terms of the Spice
05: * Software License version 1.1, a copy of which has been included
06: * with this distribution in the LICENSE.txt file.
07: */
08: package org.codehaus.spice.netserve.connection.impl;
09:
10: import java.io.IOException;
11: import java.io.InterruptedIOException;
12: import java.net.ServerSocket;
13: import java.net.Socket;
14:
15: /**
16: *
17: * @author Peter Donald
18: * @version $Revision: 1.2 $ $Date: 2004/03/21 23:42:59 $
19: */
20: class ExceptOnAcceptServerSocket extends ServerSocket {
21: static final IOException ERROR_EXCEPTION = new IOException(
22: "No Accept - ha ha!");
23: static final IOException INTERRUPTED_EXCEPTION = new InterruptedIOException(
24: "No Interuptions!");
25:
26: private boolean m_interupt;
27:
28: public ExceptOnAcceptServerSocket(final boolean interupt)
29: throws IOException {
30: m_interupt = interupt;
31: }
32:
33: public Socket accept() throws IOException {
34: if (m_interupt) {
35: throw INTERRUPTED_EXCEPTION;
36: } else {
37: throw ERROR_EXCEPTION;
38: }
39: }
40: }
|