1 /*
2  * Copyright (c) 2008-2009, Motorola, Inc.
3  *
4  * All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions are met:
8  *
9  * - Redistributions of source code must retain the above copyright notice,
10  * this list of conditions and the following disclaimer.
11  *
12  * - Redistributions in binary form must reproduce the above copyright notice,
13  * this list of conditions and the following disclaimer in the documentation
14  * and/or other materials provided with the distribution.
15  *
16  * - Neither the name of the Motorola, Inc. nor the names of its contributors
17  * may be used to endorse or promote products derived from this software
18  * without specific prior written permission.
19  *
20  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30  * POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 package com.android.bluetooth.opp;
34 
35 import android.app.Activity;
36 import android.content.ContentValues;
37 import android.content.Context;
38 import android.content.Intent;
39 import android.database.Cursor;
40 import android.net.Uri;
41 import android.os.Bundle;
42 import android.os.Handler;
43 import android.os.Message;
44 import android.util.Log;
45 import android.view.View;
46 import android.view.View.OnClickListener;
47 import android.widget.Button;
48 import android.widget.EditText;
49 
50 import com.android.bluetooth.R;
51 
52 import java.io.DataInputStream;
53 import java.io.DataOutputStream;
54 import java.io.File;
55 import java.io.FileOutputStream;
56 import java.io.IOException;
57 import java.io.InputStream;
58 import java.io.OutputStream;
59 import java.net.ServerSocket;
60 import java.net.Socket;
61 import java.net.SocketException;
62 
63 import javax.obex.Authenticator;
64 import javax.obex.HeaderSet;
65 import javax.obex.ObexTransport;
66 import javax.obex.Operation;
67 import javax.obex.ResponseCodes;
68 import javax.obex.ServerRequestHandler;
69 import javax.obex.ServerSession;
70 
71 public class TestActivity extends Activity {
72 
73     public String currentInsert;
74 
75     public int mCurrentByte = 0;
76 
77     EditText mUpdateView;
78 
79     EditText mAckView;
80 
81     EditText mDeleteView;
82 
83     EditText mInsertView;
84 
85     EditText mAddressView;
86 
87     EditText mMediaView;
88 
89     TestTcpServer mServer;
90 
91     /** Called when the activity is first created. */
92     @Override
onCreate(Bundle savedInstanceState)93     public void onCreate(Bundle savedInstanceState) {
94         super.onCreate(savedInstanceState);
95 
96         Intent intent = getIntent();
97 
98         String action = intent.getAction();
99 
100         Context c = getBaseContext();
101 
102         if (Intent.ACTION_SEND.equals(action)) {
103             /*
104              * Other application is trying to share a file via Bluetooth,
105              * probably Pictures, or vCard. The Intent should contain an
106              * EXTRA_STREAM with the data to attach.
107              */
108 
109             String type = intent.getType();
110             Uri stream = (Uri) intent.getParcelableExtra(Intent.EXTRA_STREAM);
111 
112             if (stream != null && type != null) {
113                 /*
114                  * if (MimeUtility.mimeTypeMatches(type,
115                  * Email.ACCEPTABLE_ATTACHMENT_SEND_TYPES)) {
116                  * addAttachment(stream);
117                  */
118                 Log.v(Constants.TAG,
119                         " Get share intent with Uri " + stream + " mimetype is " + type);
120                 // Log.v(Constants.TAG, " trying Uri function " +
121                 // stream.getAuthority() + " " + Uri.parse(stream));
122                 Cursor cursor = c.getContentResolver().query(stream, null, null, null, null);
123                 cursor.close();
124 
125             }
126             /* start insert a record */
127             /*
128              * ContentValues values = new ContentValues();
129              * values.put(BluetoothShare.URI, stream.toString());
130              * values.put(BluetoothShare.DESTINATION, "FF:FF:FF:00:00:00");
131              * values.put(BluetoothShare.DIRECTION,
132              * BluetoothShare.DIRECTION_OUTBOUND); final Uri contentUri =
133              * getContentResolver().insert(BluetoothShare.CONTENT_URI, values);
134              * Log.v(Constants.TAG, "insert contentUri: " + contentUri);
135              */
136         }
137         /*
138          * Context c = getBaseContext(); c.startService(new Intent(c,
139          * BluetoothOppService.class));
140          */
141 
142         setContentView(R.layout.testactivity_main);
143 
144         Button mInsertRecord = (Button) findViewById(R.id.insert_record);
145         Button mDeleteRecord = (Button) findViewById(R.id.delete_record);
146         Button mUpdateRecord = (Button) findViewById(R.id.update_record);
147 
148         Button mAckRecord = (Button) findViewById(R.id.ack_record);
149 
150         Button mDeleteAllRecord = (Button) findViewById(R.id.deleteAll_record);
151         mUpdateView = (EditText) findViewById(R.id.update_text);
152         mAckView = (EditText) findViewById(R.id.ack_text);
153         mDeleteView = (EditText) findViewById(R.id.delete_text);
154         mInsertView = (EditText) findViewById(R.id.insert_text);
155 
156         mAddressView = (EditText) findViewById(R.id.address_text);
157         mMediaView = (EditText) findViewById(R.id.media_text);
158 
159         mInsertRecord.setOnClickListener(insertRecordListener);
160         mDeleteRecord.setOnClickListener(deleteRecordListener);
161         mUpdateRecord.setOnClickListener(updateRecordListener);
162         mAckRecord.setOnClickListener(ackRecordListener);
163         mDeleteAllRecord.setOnClickListener(deleteAllRecordListener);
164 
165         Button mStartTcpServer = (Button) findViewById(R.id.start_server);
166         mStartTcpServer.setOnClickListener(startTcpServerListener);
167 
168         Button mNotifyTcpServer = (Button) findViewById(R.id.notify_server);
169         mNotifyTcpServer.setOnClickListener(notifyTcpServerListener);
170         /* parse insert result Uri */
171         /*
172          * String id = contentUri.getPathSegments().get(1); Log.v(Constants.TAG,
173          * "insert record id is " + id); Uri contentUri1 =
174          * Uri.parse(BluetoothShare.CONTENT_URI + "/" + id);
175          */
176         /* update a single column of a record */
177         /*
178          * ContentValues updateValues = new ContentValues();
179          * updateValues.put(BluetoothShare.TOTAL_BYTES, 120000);
180          * getContentResolver().update(contentUri1,updateValues,null,null);
181          */
182         /* query a single column of a record */
183         /*
184          * Cursor queryC = getContentResolver().query(contentUri1, null, null,
185          * null, null); if (queryC != null) { if (queryC.moveToFirst()) { int
186          * currentByteColumn =
187          * queryC.getColumnIndexOrThrow(BluetoothShare.CURRENT_BYTES); int
188          * currentByte = queryC.getInt(currentByteColumn);
189          */
190         /* update a column of a record */
191         /*
192          * for(int i =0;i<100;i++){ currentByte ++;
193          * updateValues.put(BluetoothShare.CURRENT_BYTES, currentByte);
194          * getContentResolver().update(contentUri1,updateValues,null,null); } }
195          * }
196          */
197         /* query whole data base */
198         /*
199          * Cursor c = managedQuery(contentUri1, new String [] {"_id",
200          * BluetoothShare.URI, BluetoothShare.STATUS,
201          * BluetoothShare.TOTAL_BYTES, BluetoothShare.CURRENT_BYTES,
202          * BluetoothShare._DATA, BluetoothShare.DIRECTION,
203          * BluetoothShare.MIMETYPE, BluetoothShare.DESTINATION,
204          * BluetoothShare.VISIBILITY, BluetoothShare.USER_CONFIRMATION,
205          * BluetoothShare.TIMESTAMP}, null, null, null); Log.v(Constants.TAG,
206          * "query " + contentUri1 +" get " + c.getCount()+" records");
207          */
208         /* delete a record */
209         /*
210          * Uri contentUri2 = Uri.parse(BluetoothShare.CONTENT_URI + "/" + 1);
211          * getContentResolver().delete(contentUri2, null, null);
212          */
213 
214     }
215 
216     public OnClickListener insertRecordListener = new OnClickListener() {
217         @Override
218         public void onClick(View view) {
219 
220             String address = null;
221             if (mAddressView.getText().length() != 0) {
222                 address = mAddressView.getText().toString();
223                 Log.v(Constants.TAG, "Send to address  " + address);
224             }
225             if (address == null) {
226                 address = "00:17:83:58:5D:CC";
227             }
228 
229             Integer media = null;
230             if (mMediaView.getText().length() != 0) {
231                 media = Integer.parseInt(mMediaView.getText().toString().trim());
232                 Log.v(Constants.TAG, "Send media no.  " + media);
233             }
234             if (media == null) {
235                 media = 1;
236             }
237             ContentValues values = new ContentValues();
238             values.put(BluetoothShare.URI, "content://media/external/images/media/" + media);
239             // values.put(BluetoothShare.DESTINATION, "FF:FF:FF:00:00:00");
240             // baibai Q9 test
241             // values.put(BluetoothShare.DESTINATION, "12:34:56:78:9A:BC");
242             // java's nokia
243             // values.put(BluetoothShare.DESTINATION, "00:1B:33:F0:58:FB");
244             // Assis phone
245             // values.put(BluetoothShare.DESTINATION, "00:17:E5:5D:74:F3");
246             // Jackson E6
247             // values.put(BluetoothShare.DESTINATION, "00:1A:1B:7F:1E:F0");
248             // Baibai V950
249             // values.put(BluetoothShare.DESTINATION, "00:17:83:58:5D:CC");
250             // Baibai NSC1173
251             // values.put(BluetoothShare.DESTINATION, "00:16:41:49:5B:F3");
252 
253             values.put(BluetoothShare.DESTINATION, address);
254 
255             values.put(BluetoothShare.DIRECTION, BluetoothShare.DIRECTION_OUTBOUND);
256 
257             Long ts = System.currentTimeMillis();
258             values.put(BluetoothShare.TIMESTAMP, ts);
259 
260             Integer records = null;
261             if (mInsertView.getText().length() != 0) {
262                 records = Integer.parseInt(mInsertView.getText().toString().trim());
263                 Log.v(Constants.TAG, "parseInt  " + records);
264             }
265             if (records == null) {
266                 records = 1;
267             }
268             for (int i = 0; i < records; i++) {
269                 Uri contentUri = getContentResolver().insert(BluetoothShare.CONTENT_URI, values);
270                 Log.v(Constants.TAG, "insert contentUri: " + contentUri);
271                 currentInsert = contentUri.getPathSegments().get(1);
272                 Log.v(Constants.TAG, "currentInsert = " + currentInsert);
273             }
274 
275         }
276     };
277 
278     public OnClickListener deleteRecordListener = new OnClickListener() {
279         @Override
280         public void onClick(View view) {
281             Uri contentUri =
282                     Uri.parse(BluetoothShare.CONTENT_URI + "/" + mDeleteView.getText().toString());
283             getContentResolver().delete(contentUri, null, null);
284         }
285     };
286 
287     public OnClickListener updateRecordListener = new OnClickListener() {
288         @Override
289         public void onClick(View view) {
290             Uri contentUri =
291                     Uri.parse(BluetoothShare.CONTENT_URI + "/" + mUpdateView.getText().toString());
292             ContentValues updateValues = new ContentValues();
293             // mCurrentByte ++;
294             // updateValues.put(BluetoothShare.TOTAL_BYTES, "120000");
295             // updateValues.put(BluetoothShare.CURRENT_BYTES, mCurrentByte);
296             // updateValues.put(BluetoothShare.VISIBILITY,
297             // BluetoothShare.VISIBILITY_HIDDEN);
298             updateValues.put(BluetoothShare.USER_CONFIRMATION,
299                     BluetoothShare.USER_CONFIRMATION_CONFIRMED);
300             getContentResolver().update(contentUri, updateValues, null, null);
301         }
302     };
303 
304     public OnClickListener ackRecordListener = new OnClickListener() {
305         @Override
306         public void onClick(View view) {
307             Uri contentUri =
308                     Uri.parse(BluetoothShare.CONTENT_URI + "/" + mAckView.getText().toString());
309             ContentValues updateValues = new ContentValues();
310             // mCurrentByte ++;
311             // updateValues.put(BluetoothShare.TOTAL_BYTES, "120000");
312             // updateValues.put(BluetoothShare.CURRENT_BYTES, mCurrentByte);
313             updateValues.put(BluetoothShare.VISIBILITY, BluetoothShare.VISIBILITY_HIDDEN);
314             // updateValues.put(BluetoothShare.USER_CONFIRMATION,
315             // BluetoothShare.USER_CONFIRMATION_CONFIRMED);
316             getContentResolver().update(contentUri, updateValues, null, null);
317         }
318     };
319 
320     public OnClickListener deleteAllRecordListener = new OnClickListener() {
321         @Override
322         public void onClick(View view) {
323             Uri contentUri = Uri.parse(String.valueOf(BluetoothShare.CONTENT_URI));
324             getContentResolver().delete(contentUri, null, null);
325         }
326     };
327 
328     public OnClickListener startTcpServerListener = new OnClickListener() {
329         @Override
330         public void onClick(View view) {
331             mServer = new TestTcpServer();
332             Thread serverThread = new Thread(mServer);
333             serverThread.start();
334         }
335     };
336 
337     public OnClickListener notifyTcpServerListener = new OnClickListener() {
338         @Override
339         public void onClick(View view) {
340             final Thread notifyThread = new Thread() {
341                 @Override
342                 public void run() {
343                     synchronized (mServer) {
344                         mServer.a = true;
345                         mServer.notify();
346                     }
347                 }
348 
349             };
350             notifyThread.start();
351         }
352 
353     };
354 }
355 
356 /**
357  * This class listens on OPUSH channel for incoming connection
358  */
359 class TestTcpListener {
360 
361     private static final String TAG = "BtOppRfcommListener";
362 
363     private static final boolean D = Constants.DEBUG;
364 
365     private static final boolean V = Constants.VERBOSE;
366 
367     private volatile boolean mInterrupted;
368 
369     private Thread mSocketAcceptThread;
370 
371     private Handler mCallback;
372 
373     private static final int ACCEPT_WAIT_TIMEOUT = 5000;
374 
375     public static final int DEFAULT_OPP_CHANNEL = 12;
376 
377     public static final int MSG_INCOMING_BTOPP_CONNECTION = 100;
378 
379     private int mBtOppRfcommChannel = -1;
380 
TestTcpListener()381     TestTcpListener() {
382         this(DEFAULT_OPP_CHANNEL);
383     }
384 
TestTcpListener(int channel)385     TestTcpListener(int channel) {
386         mBtOppRfcommChannel = channel;
387     }
388 
start(Handler callback)389     public synchronized boolean start(Handler callback) {
390         if (mSocketAcceptThread == null) {
391             mCallback = callback;
392             mSocketAcceptThread = new Thread(TAG) {
393                 ServerSocket mServerSocket;
394 
395                 @Override
396                 public void run() {
397                     if (D) {
398                         Log.d(TAG, "RfcommSocket listen thread starting");
399                     }
400                     try {
401                         if (V) {
402                             Log.v(TAG,
403                                     "Create server RfcommSocket on channel" + mBtOppRfcommChannel);
404                         }
405                         mServerSocket = new ServerSocket(6500, 1);
406                     } catch (IOException e) {
407                         Log.e(TAG, "Error listing on channel" + mBtOppRfcommChannel);
408                         mInterrupted = true;
409                     }
410                     while (!mInterrupted) {
411                         try {
412                             mServerSocket.setSoTimeout(ACCEPT_WAIT_TIMEOUT);
413                             Socket clientSocket = mServerSocket.accept();
414                             if (clientSocket == null) {
415                                 if (V) {
416                                     Log.v(TAG, "incomming connection time out");
417                                 }
418                             } else {
419                                 if (D) {
420                                     Log.d(TAG, "RfcommSocket connected!");
421                                 }
422                                 Log.d(TAG,
423                                         "remote addr is " + clientSocket.getRemoteSocketAddress());
424                                 TestTcpTransport transport = new TestTcpTransport(clientSocket);
425                                 Message msg = Message.obtain();
426                                 msg.setTarget(mCallback);
427                                 msg.what = MSG_INCOMING_BTOPP_CONNECTION;
428                                 msg.obj = transport;
429                                 msg.sendToTarget();
430                             }
431                         } catch (SocketException e) {
432                             Log.e(TAG, "Error accept connection " + e);
433                         } catch (IOException e) {
434                             Log.e(TAG, "Error accept connection " + e);
435                         }
436 
437                         if (mInterrupted) {
438                             Log.e(TAG, "socketAcceptThread thread was interrupted (2), exiting");
439                         }
440                     }
441                     if (D) {
442                         Log.d(TAG, "RfcommSocket listen thread finished");
443                     }
444                 }
445             };
446             mInterrupted = false;
447             mSocketAcceptThread.start();
448 
449         }
450         return true;
451 
452     }
453 
stop()454     public synchronized void stop() {
455         if (mSocketAcceptThread != null) {
456             if (D) {
457                 Log.d(TAG, "stopping Connect Thread");
458             }
459             mInterrupted = true;
460             try {
461                 mSocketAcceptThread.interrupt();
462                 if (V) {
463                     Log.v(TAG, "waiting for thread to terminate");
464                 }
465                 mSocketAcceptThread.join();
466                 mSocketAcceptThread = null;
467                 mCallback = null;
468             } catch (InterruptedException e) {
469                 if (V) {
470                     Log.v(TAG, "Interrupted waiting for Accept Thread to join");
471                 }
472             }
473         }
474     }
475 
476 }
477 
478 class TestTcpServer extends ServerRequestHandler implements Runnable {
479     private static final String TAG = "ServerRequestHandler";
480 
481     private static final boolean V = Constants.VERBOSE;
482 
483     static final int PORT = 6500;
484 
485     public boolean a = false;
486 
487     // TextView serverStatus = null;
488     @Override
run()489     public void run() {
490         try {
491             updateStatus("[server:] listen on port " + PORT);
492             TestTcpSessionNotifier rsn = new TestTcpSessionNotifier(PORT);
493 
494             updateStatus("[server:] Now waiting for a client to connect");
495             rsn.acceptAndOpen(this);
496             updateStatus("[server:] A client is now connected");
497         } catch (Exception ex) {
498             updateStatus("[server:] Caught the error: " + ex);
499         }
500     }
501 
TestTcpServer()502     TestTcpServer() {
503         updateStatus("enter construtor of TcpServer");
504     }
505 
506     @Override
onConnect(HeaderSet request, HeaderSet reply)507     public int onConnect(HeaderSet request, HeaderSet reply) {
508 
509         updateStatus("[server:] The client has created an OBEX session");
510         /* sleep for 2000 ms to wait for the batch contains all ShareInfos */
511         synchronized (this) {
512             try {
513                 while (!a) {
514                     wait(500);
515                 }
516             } catch (InterruptedException e) {
517                 if (V) {
518                     Log.v(TAG, "Interrupted waiting for markBatchFailed");
519                 }
520             }
521         }
522         updateStatus("[server:] we accpet the seesion");
523         return ResponseCodes.OBEX_HTTP_OK;
524     }
525 
526     @Override
onPut(Operation op)527     public int onPut(Operation op) {
528         FileOutputStream fos = null;
529         try {
530             java.io.InputStream is = op.openInputStream();
531 
532             updateStatus("Got data bytes " + is.available() + " name " + op.getReceivedHeader()
533                     .getHeader(HeaderSet.NAME) + " type " + op.getType());
534 
535             File f = new File((String) op.getReceivedHeader().getHeader(HeaderSet.NAME));
536             fos = new FileOutputStream(f);
537             byte[] b = new byte[1000];
538             int len;
539 
540             while (is.available() > 0 && (len = is.read(b)) > 0) {
541                 fos.write(b, 0, len);
542             }
543 
544             fos.close();
545             is.close();
546             updateStatus("[server:] Wrote data to " + f.getAbsolutePath());
547         } catch (Exception e) {
548             if (fos != null) {
549                 try {
550                     fos.close();
551                 } catch (IOException e1) {
552                     e1.printStackTrace();
553                 }
554             }
555             e.printStackTrace();
556         }
557         return ResponseCodes.OBEX_HTTP_OK;
558     }
559 
560     @Override
onDisconnect(HeaderSet req, HeaderSet resp)561     public void onDisconnect(HeaderSet req, HeaderSet resp) {
562         updateStatus("[server:] The client has disconnected the OBEX session");
563     }
564 
565     @Override
updateStatus(String message)566     public void updateStatus(String message) {
567         Log.v(TAG, "\n" + message);
568     }
569 
570     @Override
onAuthenticationFailure(byte[] userName)571     public void onAuthenticationFailure(byte[] userName) {
572     }
573 
574     @Override
onSetPath(HeaderSet request, HeaderSet reply, boolean backup, boolean create)575     public int onSetPath(HeaderSet request, HeaderSet reply, boolean backup, boolean create) {
576 
577         return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED;
578     }
579 
580     @Override
onDelete(HeaderSet request, HeaderSet reply)581     public int onDelete(HeaderSet request, HeaderSet reply) {
582         return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED;
583     }
584 
585     @Override
onGet(Operation op)586     public int onGet(Operation op) {
587         return ResponseCodes.OBEX_HTTP_NOT_IMPLEMENTED;
588     }
589 
590 }
591 
592 class TestTcpSessionNotifier {
593     /* implements SessionNotifier */
594 
595     ServerSocket mServer = null;
596 
597     Socket mConn = null;
598 
599     private static final String TAG = "TestTcpSessionNotifier";
600 
TestTcpSessionNotifier(int port)601     TestTcpSessionNotifier(int port) throws IOException {
602         mServer = new ServerSocket(port);
603     }
604 
acceptAndOpen(ServerRequestHandler handler, Authenticator auth)605     public ServerSession acceptAndOpen(ServerRequestHandler handler, Authenticator auth)
606             throws IOException {
607         try {
608             mConn = mServer.accept();
609 
610         } catch (Exception ex) {
611             Log.v(TAG, "ex");
612         }
613 
614         TestTcpTransport tt = new TestTcpTransport(mConn);
615 
616         return new ServerSession((ObexTransport) tt, handler, auth);
617 
618     }
619 
acceptAndOpen(ServerRequestHandler handler)620     public ServerSession acceptAndOpen(ServerRequestHandler handler) throws IOException {
621 
622         return acceptAndOpen(handler, null);
623 
624     }
625 
626 }
627 
628 class TestTcpTransport implements ObexTransport {
629 
630     Socket mSocket = null;
631 
TestTcpTransport(Socket s)632     TestTcpTransport(Socket s) {
633         super();
634         this.mSocket = s;
635     }
636 
637     @Override
close()638     public void close() throws IOException {
639         mSocket.close();
640     }
641 
642     @Override
openDataInputStream()643     public DataInputStream openDataInputStream() throws IOException {
644         return new DataInputStream(openInputStream());
645     }
646 
647     @Override
openDataOutputStream()648     public DataOutputStream openDataOutputStream() throws IOException {
649         return new DataOutputStream(openOutputStream());
650     }
651 
652     @Override
openInputStream()653     public InputStream openInputStream() throws IOException {
654         return mSocket.getInputStream();
655     }
656 
657     @Override
openOutputStream()658     public OutputStream openOutputStream() throws IOException {
659         return mSocket.getOutputStream();
660     }
661 
662     @Override
connect()663     public void connect() throws IOException {
664         // TODO Auto-generated method stub
665 
666     }
667 
668     @Override
create()669     public void create() throws IOException {
670         // TODO Auto-generated method stub
671 
672     }
673 
674     @Override
disconnect()675     public void disconnect() throws IOException {
676         // TODO Auto-generated method stub
677 
678     }
679 
680     @Override
listen()681     public void listen() throws IOException {
682         // TODO Auto-generated method stub
683 
684     }
685 
isConnected()686     public boolean isConnected() throws IOException {
687         return mSocket.isConnected();
688     }
689 
690     @Override
getMaxTransmitPacketSize()691     public int getMaxTransmitPacketSize() {
692         return -1;
693     }
694 
695     @Override
getMaxReceivePacketSize()696     public int getMaxReceivePacketSize() {
697         return -1;
698     }
699 
700     @Override
isSrmSupported()701     public boolean isSrmSupported() {
702         // TODO: It should be possible to use SRM in TCP connections
703         return false;
704     }
705 }
706