public void xxtestAsynchWrite() throws Exception {
        mockSelect.setDefaultReturnValue("getThread", Thread.currentThread());
        MySelectableChannel channel = new MySelectableChannel((SocketChannel)mockSunsChannel);
        MyKey key = new MyKey(channel);
        mockSunsChannel.setDefaultReturnValue("getSelectableChannel", channel);
        MockObject mockKey = key.getMock();
        mockKey.setDefaultReturnValue("channel", mockSunsChannel);
        mockKey.setDefaultReturnValue("readyOps", SelectionKey.OP_WRITE);
        
        mockSunsChannel.setDefaultBehavior("write", new NoReadByteBuffer2(0));
        
        client1.oldConnect(null);
        mockSunsChannel.expect("connect");
        
        ByteBuffer b = ByteBuffer.allocate(1000);        
        String expected = "abc";
        HELPER.putString(b, expected);
        HELPER.doneFillingBuffer(b);

        mockSelect.addReturnValue("createRegistrationListener", mockRegListener);
        mockSunsChannel.addReturnValue("write", 0);        
        client1.oldWrite(b, (OperationCallback)mockWriteHandler);
        mockSunsChannel.expect("write");
        
        mockSelect.setDefaultReturnValue("getKeyFromChannel", key);
        String[] methodNames = new String[] { "getKeyFromChannel", "register" };
        CalledMethod[] methods = mockSelect.expect(methodNames);
        Object attachment = methods[1].getAllParams()[2];
        key.attach(attachment);

        Set<SelectionKey> set = new HashSet<SelectionKey>();
        set.add(key);
        mockSelect.addReturnValue("select", 1);
        mockSelect.addReturnValue("selectedKeys", set);
        
        mockKey.addReturnValue("interestOps", SelectionKey.OP_WRITE);
        mockSunsChannel.addReturnValue("write", b.remaining());
        //now, simlute the jdk selector going off....
        listener.selectorFired();
        
        CalledMethod m = mockSunsChannel.expect("write");
        ByteBuffer actual = (ByteBuffer)m.getAllParams()[0];
        String msg = HELPER.readString(actual, actual.remaining());
        assertEquals(expected, msg);
    }