Direct-BT v3.3.0-1-gc2d430c
Direct-BT - Direct Bluetooth Programming.
TestDBTClientServer12_NoEnc.java
Go to the documentation of this file.
1/**
2 * Author: Sven Gothel <sgothel@jausoft.com>
3 * Copyright (c) 2022 Gothel Software e.K.
4 *
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be
14 * included in all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
17 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
18 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
19 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
20 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
21 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
22 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
23 */
24
25package trial.org.direct_bt;
26
27import org.direct_bt.BTSecurityLevel;
28import org.junit.FixMethodOrder;
29import org.junit.Test;
30import org.junit.runners.MethodSorters;
31
32/**
33 * Testing a full Bluetooth server and client lifecycle of operations, requiring two BT adapter:
34 * - operating w/o encryption
35 * - start server advertising
36 * - start client discovery and connect to server when discovered
37 * - client/server processing of connection when ready
38 * - client disconnect
39 * - server stop advertising
40 * - security-level: NONE, ENC_ONLY freshly-paired and ENC_ONLY pre-paired
41 * - reuse server-adapter for client-mode discovery (just toggle on/off)
42 */
43@FixMethodOrder(MethodSorters.NAME_ASCENDING)
45 static final boolean serverSC = true;
46
47 @Test(timeout = 20000)
48 public final void test02_FullCycle_EncNone() {
49 final ExpectedPairing serverExpPairing = ExpectedPairing.DONT_CARE;
50 final ExpectedPairing clientExpPairing = ExpectedPairing.DONT_CARE;
51 test8x_fullCycle(20000, "12", 1, false /* server_client_order */, serverSC,
52 BTSecurityLevel.NONE, serverExpPairing, BTSecurityLevel.NONE, clientExpPairing);
53 }
54
55 @Test(timeout = 30000)
56 public final void test03_FullCycle_EncNone() {
57 final ExpectedPairing serverExpPairing = ExpectedPairing.DONT_CARE;
58 final ExpectedPairing clientExpPairing = ExpectedPairing.DONT_CARE;
59 test8x_fullCycle(30000, "13", 2, false /* server_client_order */, serverSC,
60 BTSecurityLevel.NONE, serverExpPairing, BTSecurityLevel.NONE, clientExpPairing);
61 }
62
63 public static void main(final String args[]) {
64 org.junit.runner.JUnitCore.main(TestDBTClientServer12_NoEnc.class.getName());
65 }
66}
Testing a full Bluetooth server and client lifecycle of operations, requiring two BT adapter:
Testing a full Bluetooth server and client lifecycle of operations, requiring two BT adapter:
Bluetooth Security Level.
NONE
No encryption and no authentication.