1 // **********************************************************************
3 // Copyright (c) 2003-2011 ZeroC, Inc. All rights reserved.
5 // This copy of Ice is licensed to you under the terms described in the
6 // ICE_LICENSE file included in this distribution.
8 // **********************************************************************
10 package test
.Ice
.background
;
12 final class Transceiver
implements IceInternal
.Transceiver
14 public java
.nio
.channels
.SelectableChannel
17 return _transceiver
.fd();
23 int status
= _configuration
.initializeSocketStatus();
24 if(status
== IceInternal
.SocketOperation
.Connect
|| status
== IceInternal
.SocketOperation
.Write
)
28 status
= _transceiver
.initialize();
29 if(status
!= IceInternal
.SocketOperation
.None
)
35 return IceInternal
.SocketOperation
.Write
;
37 else if(status
== IceInternal
.SocketOperation
.Read
)
42 _configuration
.checkInitializeException();
45 status
= _transceiver
.initialize();
46 if(status
!= IceInternal
.SocketOperation
.None
)
52 return IceInternal
.SocketOperation
.None
;
62 write(IceInternal
.Buffer buf
)
66 throw new Ice
.SocketException();
69 if(!_configuration
.writeReady())
73 _configuration
.checkWriteException();
74 return _transceiver
.write(buf
);
78 read(IceInternal
.Buffer buf
, Ice
.BooleanHolder moreData
)
82 throw new Ice
.SocketException();
87 if(!_configuration
.readReady())
92 _configuration
.checkReadException();
93 return _transceiver
.read(buf
, moreData
);
99 return "test-" + _transceiver
.type();
105 return _transceiver
.toString();
108 public Ice
.ConnectionInfo
111 return _transceiver
.getInfo();
115 checkSendSize(IceInternal
.Buffer buf
, int messageSizeMax
)
117 _transceiver
.checkSendSize(buf
, messageSizeMax
);
121 // Only for use by Connector, Acceptor
123 Transceiver(Configuration configuration
, IceInternal
.Transceiver transceiver
)
125 _transceiver
= transceiver
;
126 _configuration
= configuration
;
129 protected synchronized void
136 final private IceInternal
.Transceiver _transceiver
;
137 final private Configuration _configuration
;
138 private boolean _initialized
= false;