public TcpWorker(Socket socket, AbstractMessageReceiver receiver) throws IOException { super(socket, receiver, ((TcpConnector) connector).getTcpProtocol().createResponse(socket)); this.socket = socket; final TcpConnector tcpConnector = ((TcpConnector) connector); protocol = tcpConnector.getTcpProtocol(); try { tcpConnector.configureSocket(TcpConnector.SERVER, socket); underlyingIn = new BufferedInputStream(socket.getInputStream()); dataIn = new TcpInputStream(underlyingIn) { public void close() throws IOException { // Don't actually close the stream, we just want to know if the // we want to stop receiving messages on this sockete. // The Protocol is responsible for closing this. dataInWorkFinished = true; moreMessages = false; synchronized (notify) { notify.notifyAll(); } } }; dataOut = new BufferedOutputStream(socket.getOutputStream()); } catch (IOException e) { logger.error("Failed to set Socket properties: " + e.getMessage(), e); } }