~vcs-imports/skycastle/trunk

« back to all changes in this revision

Viewing changes to modules/core/src/main/java/org/skycastle/connection/ClientConnectionHandlerImpl.java

  • Committer: zzorn
  • Date: 2008-11-10 14:55:40 UTC
  • Revision ID: vcs-imports@canonical.com-20081110145540-l1hvmkbhnd0612ws
Fixed compile: removed packages of unused code, updated to use new Darkstar API, moved external library versions to the master pom.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
import java.io.IOException;
19
19
import java.net.PasswordAuthentication;
 
20
import java.nio.ByteBuffer;
20
21
import java.util.Properties;
21
22
 
22
23
/**
126
127
 
127
128
            try
128
129
            {
129
 
                final byte[] bytes = protocol.encode( message );
 
130
                final ByteBuffer bytes = protocol.encode( message );
 
131
 
130
132
                mySimpleClient.send( bytes );
131
133
            }
132
134
            catch ( ProtocolException e )
200
202
                throw new UnsupportedOperationException( "This method has not yet been implemented." ); // IMPLEMENT
201
203
            }
202
204
 
203
 
 
204
 
            public void receivedMessage( byte[] bytes )
 
205
            public void receivedMessage( final ByteBuffer byteBuffer )
205
206
            {
206
207
                final NegotiationStatus negotiationStatus = myProtocolNegotiator.getStatus();
207
208
                if ( !negotiationStatus.isFinished() )
208
209
                {
209
 
                    handleProtocolNegotiationMessage( bytes );
 
210
                    handleProtocolNegotiationMessage( byteBuffer );
210
211
                }
211
212
                else if ( negotiationStatus.isSuccess() )
212
213
                {
213
 
                    handleCommunicationMessage( bytes );
 
214
                    handleCommunicationMessage( byteBuffer );
214
215
                }
215
216
            }
216
217
 
244
245
    }
245
246
 
246
247
 
247
 
    private void handleProtocolNegotiationMessage( final byte[] bytes )
 
248
    private void handleProtocolNegotiationMessage( final ByteBuffer bytes )
248
249
    {
249
 
        final byte[] reply = myProtocolNegotiator.handleMessage( bytes );
 
250
        final ByteBuffer reply = myProtocolNegotiator.handleMessage( bytes );
250
251
 
251
252
        if ( reply != null )
252
253
        {
285
286
    }
286
287
 
287
288
 
288
 
    private void handleCommunicationMessage( final byte[] bytes )
 
289
    private void handleCommunicationMessage( final ByteBuffer bytes )
289
290
    {
290
291
        final Protocol protocol = myProtocolNegotiator.getProtocol();
291
292