import java.io.*;
import javax.microedition.io.*;
import javax.bluetooth.*;

public class L2CAPClient {
    public static void main( String args[] ) {
        try {
            String url = "btl2cap://000eed3d1829:1101";

            L2CAPConnection con = 
                (L2CAPConnection) Connector.open(url);

            String greeting = "JSR-82 L2CAP client says hello";
            con.send( greeting.getBytes() );

            byte buffer[] = new byte[80];
            int bytes_read = con.receive( buffer );
            String received = new String(buffer, 0, bytes_read);
            System.out.println("received: " + received);
            
            con.close();
        } catch ( IOException e ) {
            System.err.print(e.toString());
        }
    }
}
