diff --git a/tests/connect.toml b/tests/connect.toml
deleted file mode 100644
index d3aa5a1..0000000
--- a/tests/connect.toml
+++ /dev/null
@@ -1,20 +0,0 @@
-[gateway]
-
-    name = "hamlocalconnect"
-
-[[broker."mosquitto/1"]]
-
-    host = "localhost"
-    port = 1883
-
-    retry_interval = 10
-
-
-[device."dora"]
-
-    type = "dummy"
-    broker = "mosquitto"
-    qos = 0
-
-    interval = 10
-    payload = "connect local pub only Hello world."
diff --git a/tests/connect_test.go b/tests/connect_test.go
deleted file mode 100644
index 673c74a..0000000
--- a/tests/connect_test.go
+++ /dev/null
@@ -1,104 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"fmt"
-	"testing"
-	"time"
-
-	MQTT "github.com/eclipse/paho.mqtt.golang"
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji"
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/device"
-	"github.com/shiguredo/fuji/gateway"
-)
-
-// publish test to broker on localhost
-// dummydevice is used as a source of published message
-func TestConnectLocalPub(t *testing.T) {
-
-	go fuji.Start("connect.toml")
-
-	time.Sleep(2 * time.Second)
-	return
-}
-
-// TestConnectLocalPubSub tests
-// 1. connect gateway to local broker
-// 2. send data from dummy
-// 3. check subscribe
-func TestConnectLocalPubSub(t *testing.T) {
-	assert := assert.New(t)
-
-	// pub/sub test to broker on localhost
-	// dummydevice is used as a source of published message
-	// publised messages confirmed by subscriber
-
-	// get config
-	conf, err := config.LoadConfig("connect.toml")
-	assert.Nil(err)
-
-	// get Gateway
-	gw, err := gateway.NewGateway(conf)
-	assert.Nil(err)
-
-	// get Broker
-	brokerList, err := broker.NewBrokers(conf, gw.BrokerChan)
-	assert.Nil(err)
-
-	// get DummyDevice
-	dummyDevice, err := device.NewDummyDevice(conf.Sections[2], brokerList, device.NewDeviceChannel())
-	assert.Nil(err)
-	assert.NotNil(dummyDevice)
-
-	// Setup MQTT pub/sub client to confirm published content.
-	//
-	subscriberChannel := make(chan [2]string)
-
-	opts := MQTT.NewClientOptions()
-	url := fmt.Sprintf("tcp://%s:%d", brokerList[0].Host, brokerList[0].Port)
-	opts.AddBroker(url)
-	opts.SetClientID(fmt.Sprintf("prefix%s", gw.Name))
-	opts.SetCleanSession(false)
-
-	client := MQTT.NewClient(opts)
-	assert.Nil(err)
-	if token := client.Connect(); token.Wait() && token.Error() != nil {
-		assert.Nil(token.Error())
-	}
-
-	qos := 0
-	expectedTopic := fmt.Sprintf("/%s/%s/%s/publish", gw.Name, dummyDevice.Name, dummyDevice.Type)
-	expectedMessage := fmt.Sprintf("%s", dummyDevice.Payload)
-	fmt.Printf("expetcted topic: %s\nexpected message%s", expectedTopic, expectedMessage)
-	client.Subscribe(expectedTopic, byte(qos), func(client *MQTT.Client, msg MQTT.Message) {
-		subscriberChannel <- [2]string{msg.Topic(), string(msg.Payload())}
-	})
-
-	// wait for 1 publication of dummy worker
-	select {
-	case message := <-subscriberChannel:
-		assert.Equal(expectedTopic, message[0])
-		assert.Equal(expectedMessage, message[1])
-	case <-time.After(time.Second * 11):
-		assert.Equal("subscribe completed in 11 sec", "not completed")
-	}
-
-	client.Disconnect(20)
-}
diff --git a/tests/mosquitto/ca.key b/tests/mosquitto/ca.key
deleted file mode 100644
index bc2eadc..0000000
--- a/tests/mosquitto/ca.key
+++ /dev/null
@@ -1,18 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-Proc-Type: 4,ENCRYPTED
-DEK-Info: DES-EDE3-CBC,965D3104A27A8D8D
-
-+Ek6vaIgZA4wsEcQkzBonm+GXj2yqpn6mLXcXngEp/Z/qYJ/u9zbwiTl6mDsov4M
-4FB8qyycIOHmwnmHWNwel/YqUb5i6GYc9eeT3DPE2zgNIUb/hybsEg5j1ux9GU/P
-OIrC1bf1Kx+P+S+1Cfy3xCLxwpgr/XUVAlREWgqIDDqoK0paZQm3FLgYyy3Q1efU
-IeChXRWi4wYnugPhNSPqr+ZYBTxIbPZwSjk4HnSgXdPkE2ltgfeuDXvM4QYcB04Y
-GnHQ7b39wFkb9CUDjZyKQGWx6IN7bTO3TV0aarHnbzwN8doB49ovQZta88kTd99x
-8qgKc5ha5uq4YstjcBBVhraG1ZsJi/pg2OdP42N0N5ccWu2QFut28uLlMoBUX6PE
-Tw8Bub7AdDpJCVIJo5QzRx4+xhs4EfHUjTbq0R9ZE09qaVBQ1UlG6VMKF5sgrraw
-JEQ/cGDM/r84+E3NwLuLJF6fjYooYKgcPu3hVpfjWEK8QanAVNiBo7Uoq5126NLE
-fIkPwfnALCLCBzV2N5Yfk1zM4F9d03+PaN4EPrB4dfwoew7zKdXW7AwmEcVT7Z20
-rLTndsjnVkn+7AObaftPB7ex/4uAS8NX0l8Si6o25oQVopU70/FSG4vyESfm4nEl
-7aOVOPc9hTdNmHwrwBm92DeTYZC9ZyQ5ofomJW6ZQbhzTYwIsxOf/a5+FIo+HtNs
-qLel6I/x8Vd+TN5dwujDkX21pN1jsF/MmrlSDLd09p9jmS0/pK86xy+hrazIbLU5
-oqyvO5OmIUF3GSOGQnKn9C5kDykXsU1vMweeTJhr2iRRXs1VUhX5Pw==
------END RSA PRIVATE KEY-----
diff --git a/tests/mosquitto/ca.pem b/tests/mosquitto/ca.pem
deleted file mode 100644
index 661effa..0000000
--- a/tests/mosquitto/ca.pem
+++ /dev/null
@@ -1,17 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICqjCCAhOgAwIBAgIJAKk2CA51YCAVMA0GCSqGSIb3DQEBBQUAMEMxCzAJBgNV
-BAYTAkpQMRMwEQYDVQQIEwpTb21lLVN0YXRlMRAwDgYDVQQKEwdTb21lT3JnMQ0w
-CwYDVQQDEwRyb290MB4XDTE1MTExNjA4MDExMloXDTI1MTExMzA4MDExMlowQzEL
-MAkGA1UEBhMCSlAxEzARBgNVBAgTClNvbWUtU3RhdGUxEDAOBgNVBAoTB1NvbWVP
-cmcxDTALBgNVBAMTBHJvb3QwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAMlL
-Gg9sSZzqwNYJxM1+DQ4rkuLQuXg4HOAc6r1d+64PXShroAn+HemJuXP/Z4rInwIj
-LYbhYGU1AkCoX/776U61DEAkrioNWdvV3OZiwdgmLL+1tkjQC4QuineRy9xn49N0
-qr2a6qV0gkz4ZM4WnKaGRiLOSyCI5rhagAVLwoFNAgMBAAGjgaUwgaIwHQYDVR0O
-BBYEFN7Iif0cRQiYVoWbXhqKI5LkkxGYMHMGA1UdIwRsMGqAFN7Iif0cRQiYVoWb
-XhqKI5LkkxGYoUekRTBDMQswCQYDVQQGEwJKUDETMBEGA1UECBMKU29tZS1TdGF0
-ZTEQMA4GA1UEChMHU29tZU9yZzENMAsGA1UEAxMEcm9vdIIJAKk2CA51YCAVMAwG
-A1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQADgYEAwn+DC1gG+O+oTGP4hJESOm6f
-IkTYSx4jmyuKqcR6VhLgX3H8bUHyH/B3Oqi8cnhgIhPq+6wf6jyV3KaUio46Jl7E
-hG2z3Rz9ZHgBrDrxvkR55ZTOFOf0FCSduxErnWKPllQCOzzLcZEuZAWvRKTM3NQw
-XB+OQcJgenRLw9n9cb4=
------END CERTIFICATE-----
diff --git a/tests/mosquitto/client.csr b/tests/mosquitto/client.csr
deleted file mode 100644
index 84a6dc7..0000000
--- a/tests/mosquitto/client.csr
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE REQUEST-----
-MIIClTCCAX0CAQAwUDELMAkGA1UEBhMCSlAxEzARBgNVBAgTClNvbWUtU3RhdGUx
-GTAXBgNVBAoTEFNPTUVPUkdBTklaQVRJT04xETAPBgNVBAMTCHVzZXJuYW1lMIIB
-IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAuRBC17Y+/rgQMagOGqCdH58J
-LNv59R8HFHKiawvNJavtwEJRqfLytRwtyXjxalUOe7GlwvBAKiG/h7xE9HqoZzgs
-DWYyAEgAyedHxcoGg7ekRBTXUpkLxhxdCJBuUm26WN8PS0VdiCcqXBU5NH0DYPMX
-3OCl+Qdf+qEc+2yvN6fJC2up1gJ+FgufC2jaq8zwE77tBEZmWS/r3nk0EO2XFQ/Z
-Csz4XOrrKIX3Yq3r3BxWfQh/9ek7Zg0jqj1jjg4spAvsg9qjbfbE5BM/58XZ7EiS
-wht/1pMau6pgfEC8obfJU5AbiWrlXP6ERZQqpwbfkKorNnp/bw0EgiszT92y5wID
-AQABoAAwDQYJKoZIhvcNAQELBQADggEBAJlzPonKVkhimeMMwpJViHGtOlDOmcrT
-0hZIVGh95om4nmz6KcjvnRgHeb/XhgHkbtzOJW6DwxgYA/BGQHEGl/XAVAb5XIgG
-P8VN4U5U34dwzJaENuMbJtjx2U5+ZADfRLnj6foTd2vz/pyTfwUixX9rKMQRsgbV
-AU4FfEqpqgkh1WckSTgIlP3YaWJhJmgetNSxdFCa36YOhPztEqCRJEKopBXCwupX
-mGsdWjWkVyRqhFTjn2M82YKyp+WJGNYwva6akOfeWn0oJ4QchaMJG4s/WvGSP6TN
-y2ikm4462WBsbflIdF2c0N0UXScNyHBko0DpGNKzbQC0C2mbETeiguo=
------END CERTIFICATE REQUEST-----
diff --git a/tests/mosquitto/client.key b/tests/mosquitto/client.key
deleted file mode 100644
index 9ee7edd..0000000
--- a/tests/mosquitto/client.key
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEpAIBAAKCAQEAuRBC17Y+/rgQMagOGqCdH58JLNv59R8HFHKiawvNJavtwEJR
-qfLytRwtyXjxalUOe7GlwvBAKiG/h7xE9HqoZzgsDWYyAEgAyedHxcoGg7ekRBTX
-UpkLxhxdCJBuUm26WN8PS0VdiCcqXBU5NH0DYPMX3OCl+Qdf+qEc+2yvN6fJC2up
-1gJ+FgufC2jaq8zwE77tBEZmWS/r3nk0EO2XFQ/ZCsz4XOrrKIX3Yq3r3BxWfQh/
-9ek7Zg0jqj1jjg4spAvsg9qjbfbE5BM/58XZ7EiSwht/1pMau6pgfEC8obfJU5Ab
-iWrlXP6ERZQqpwbfkKorNnp/bw0EgiszT92y5wIDAQABAoIBAHJ4pn/70PeKLyoo
-A6Fg3A/lNa2z2+dNa/mv9ts0D49Py95yp0TybEKuzXuj/eCCAFVuy1PLfEUTXv+8
-6wI2pNhEHKulHSSjZSl+kBy+HE15WHhsU8xZsri2bq2PeU4vZWb3guRSYcqIP2F6
-F0pqUZ60f3w20TM65pmG8wBqd+96Igb4pU2h+ZerqqEHxwt7lN7aSjgRiD0jEK+N
-PeeXHVVLuXVwL8zlPScZMCh64RXtkyJ1/a9+9U60LYWjuYs8IGrGBsX2rizbqi7L
-OjeZ6jO4IvlCBruLMMJ4aoUf+OgIlSoqfcpZ5KlY0D3W3vlXTpAYrG+kRTYTqpbc
-fOastgECgYEA5AkVExYsLGXbOJaDb+Ptkx3YtXPQkHe3xVYc4jxC5DR0zSThixIC
-S+KL0B2vfhZy9SCdSOJ/F+/lAs0InNsP/G2oF0cuop1rQdn3GAbOiyiASvjL8PnP
-LUmQhEburxfsfam3OZFwKGveNqA/pCkoQ98eBx7QMbWq59C2Cuw8rWcCgYEAz8If
-V8yPblxhVw5cu8HU086prJFIZyksyaWWUhP84IuZJa52hvzy8M+xostSQfc7D+V/
-w3AKNSiSuabgSSmN0f+pLNosSVb36N+QFNCPBaBDqOP97fuIZlslCBaWm+etVE90
-oAJDKllNglWm/rQwoPoJWklME9aNpNe1HkPd3oECgYEAs3jieU8uHRNdYkAz2lBN
-n0gSU11/fPR8Unff67759pnCg+LPEKFv5UG8QGPcxyPr/jlZERASb0iDuZyddraC
-8m1rqkZ/0cSLshxWeTaCQMvzjQ4blOFHyaDoePNKz8vIeW6lok1xNJ8RGXUuIYmz
-AxgLjhcWTMlqZWDCpf4gE2kCgYEAx5hl6EHcYlhaI/rmWHOldj+LfwCsoH9MSgXN
-XtlZDpjO7wanVJRbCcNfk1jmk/1jPqhrkGVpSRzLqZSK0X8cgu2tqCuKdIMa9R0j
-HPwpC2ym0/EFmccXic5yy0x4MRvox6D2GGtT/7F/54FGSFjwhxbwOU9FyaFMv1uE
-46ir1QECgYB0KnNQI4OLffaxnod8qsrSIC4muaXn3AFIKz76isQ5L6VSh+SZVHFe
-0P6q6XURsmlD8hZwdMMYN1OV0k9lrI2F5KeGs9B28P1RTM3cN5PhYgmVf3HNQU4N
-qcJW6ilH/dpBsyw7v5zrV5+MCDKiHPq0HGBn+Ea6vM7XxSJP3wE0jQ==
------END RSA PRIVATE KEY-----
diff --git a/tests/mosquitto/client.pem b/tests/mosquitto/client.pem
deleted file mode 100644
index 2dfed47..0000000
--- a/tests/mosquitto/client.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICjjCCAfcCCQC25uKBpE2iKzANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJK
-UDETMBEGA1UECBMKU29tZS1TdGF0ZTEQMA4GA1UEChMHU29tZU9yZzENMAsGA1UE
-AxMEcm9vdDAeFw0xNTExMTYwODA3NDlaFw0xNjExMTUwODA3NDlaMFAxCzAJBgNV
-BAYTAkpQMRMwEQYDVQQIEwpTb21lLVN0YXRlMRkwFwYDVQQKExBTT01FT1JHQU5J
-WkFUSU9OMREwDwYDVQQDEwh1c2VybmFtZTCCASIwDQYJKoZIhvcNAQEBBQADggEP
-ADCCAQoCggEBALkQQte2Pv64EDGoDhqgnR+fCSzb+fUfBxRyomsLzSWr7cBCUany
-8rUcLcl48WpVDnuxpcLwQCohv4e8RPR6qGc4LA1mMgBIAMnnR8XKBoO3pEQU11KZ
-C8YcXQiQblJtuljfD0tFXYgnKlwVOTR9A2DzF9zgpfkHX/qhHPtsrzenyQtrqdYC
-fhYLnwto2qvM8BO+7QRGZlkv6955NBDtlxUP2QrM+Fzq6yiF92Kt69wcVn0If/Xp
-O2YNI6o9Y44OLKQL7IPao232xOQTP+fF2exIksIbf9aTGruqYHxAvKG3yVOQG4lq
-5Vz+hEWUKqcG35CqKzZ6f28NBIIrM0/dsucCAwEAATANBgkqhkiG9w0BAQUFAAOB
-gQAWajbip5KzoaxcbT7N5SYPDjLC8eoTxHQkwUPhiPSGMhHxWyGR9Z2LfD05EAcR
-0ZFFWFm+InNizxJHPP5p2zA+1k0XdyphkHhVMPKT8XKj8+xMrNBPxflRiu0iDoO1
-UJoNHHO7MxoLUYhLxHIyXUTeorvA2g5a6mYyPjeJ7wxorA==
------END CERTIFICATE-----
diff --git a/tests/mosquitto/mosquitto.conf b/tests/mosquitto/mosquitto.conf
deleted file mode 100644
index 9e90405..0000000
--- a/tests/mosquitto/mosquitto.conf
+++ /dev/null
@@ -1,21 +0,0 @@
-user mosquitto
-log_dest file /mosquitto/mosquitto.log
-log_timestamp true
-log_type all
-
-listener 1883
-
-listener 8883
-cafile /mosquitto/ca.pem
-certfile /mosquitto/server.pem
-keyfile /mosquitto/server.key
-require_certificate false
-
-listener 9883
-cafile /mosquitto/ca.pem
-certfile /mosquitto/server.pem
-keyfile /mosquitto/server.key
-require_certificate true
-
-listener 8080
-protocol websockets
diff --git a/tests/mosquitto/server.csr b/tests/mosquitto/server.csr
deleted file mode 100644
index 8c02ad2..0000000
--- a/tests/mosquitto/server.csr
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE REQUEST-----
-MIIChTCCAW0CAQAwQDELMAkGA1UEBhMCSlAxEzARBgNVBAgTClNvbWUtU3RhdGUx
-EDAOBgNVBAoTB1NvbWVPcmcxCjAIBgNVBAMUASowggEiMA0GCSqGSIb3DQEBAQUA
-A4IBDwAwggEKAoIBAQC3F7oL97GoSnwyWu3FNZGpJQhLhcHPqgSn7tH+mc6rcuYI
-zoaIob9A0Km1KC1g5XzE9DRmznwGDVyGtLbrtauELxVteJiESWOKb3T/D98ay09c
-ETz+EHDaUmVkKueQyZkUVTgJf0v/n+oSXF44CAZYFm89019qk6lt2XED9I2rCXl+
-ngDQaN3HLcHyzEfNSkEqXX0R4W6UojuoCu27h8pCe1PEwuBzMM2NcTXg6abdxTRT
-Uy1r02PIQ2bpRRl5zGwJYzosw2LzfCNvy62JvMaxsW4aZhxKhFJ81U6uXCj2+bSI
-M16xGyZ5D4x58qO29McQZSWfUAhkhOpwkV9lTHAbAgMBAAGgADANBgkqhkiG9w0B
-AQsFAAOCAQEAKkmC35InxJ2s/jutm0fBmvdBcSZt/ta1qUrWq3wEVroJuEENb8G1
-PZ86+dxxfenDw42Uj2vV/ndTVO6NBOEfxhu2fLlFdY8CL3z3R2UbSQ0AcRD4guKE
-PA4dTOiLJYi93ld2qgKb11tT7uysMCnhDcgl2zoCZcqaTM+0QryQsC1i/pPkT6yP
-ulikkel/28bz0+Wgi9lUltlF3lRfk3EwBqdZggX4YdEyzq6IfRYo5JyDNQ5t4NAX
-2mbYhBuwCZY4LFCARuvum2AWctTfCVdDMlkV99RKobh0aTCozD9Qbp4tjvcdN63b
-fMWP0yZS0vwinPzmP+aOl06YcNibqFyebA==
------END CERTIFICATE REQUEST-----
diff --git a/tests/mosquitto/server.key b/tests/mosquitto/server.key
deleted file mode 100644
index d9d2eba..0000000
--- a/tests/mosquitto/server.key
+++ /dev/null
@@ -1,27 +0,0 @@
------BEGIN RSA PRIVATE KEY-----
-MIIEowIBAAKCAQEAtxe6C/exqEp8MlrtxTWRqSUIS4XBz6oEp+7R/pnOq3LmCM6G
-iKG/QNCptSgtYOV8xPQ0Zs58Bg1chrS267WrhC8VbXiYhEljim90/w/fGstPXBE8
-/hBw2lJlZCrnkMmZFFU4CX9L/5/qElxeOAgGWBZvPdNfapOpbdlxA/SNqwl5fp4A
-0Gjdxy3B8sxHzUpBKl19EeFulKI7qArtu4fKQntTxMLgczDNjXE14Omm3cU0U1Mt
-a9NjyENm6UUZecxsCWM6LMNi83wjb8utibzGsbFuGmYcSoRSfNVOrlwo9vm0iDNe
-sRsmeQ+MefKjtvTHEGUln1AIZITqcJFfZUxwGwIDAQABAoIBAQCxgJ8t2wSxUwT1
-DJJXDogYo35XOWWcHghFhpKvcg2aydmZ0B89dxIjlCfzKPBVcCZ2CwqCYMx8UZfS
-QIDWI1oU3FC5wKCcH0oRe9zBKnHxWAmoCE5JQUcnYZpKcg3toIR34eZhzrevKymS
-g1oUmDMOUzGljraCbIVlqdiXLQ/rL67OKHFZP4qEbCqEv8eIBEKMAL7E7S6PAuqa
-gMCter26fMvEJADheBIyqTc63Pz/XJIJCLFdySl3WYv69IHnLcXB/oQngo/anjb2
-LbDwxyxZfkiJWfEa8RtL2qWoOsrfuzGICEz0TG6gA+5ZIW9hmrihI/fh7QKvtEJD
-/+EqgogBAoGBAOzf9lfVqe9j2VK6KkQUgdjp9JrtyCbyI8ooEToXuEmwjFz9vwyi
-pEJgzNvorHZrGZ+pmUg12R877g6WcYOxW9dnGR/LDdcE9cjfUYt3104sE212z1SC
-2lOywhrmGwlG/jkS/tK4WrLm8jBNEaxA4vB6VvVI1WLiBb6+3SQMzsHBAoGBAMXg
-H+TMY+NZHfa6XT4pjaKHcIL22+SQTuRkJOoOt0gj2GAMgwBW7WxhVJDAIqlWyCJW
-+KUKKW29o4fRX7/2RwLwRxzfIrmFg+XL1TJi5jEGYVSb+MsMUBpDw/c8W7x+guxT
-xYOKSAO78ZfiSncoqwk1sL09Ya3W20lhXngpOLDbAoGAUP2itRWRLRDu1aJhoTWB
-0DDuOarjrK1OH2jjuwExOcDrvT/leuSBVVDTur0rerHT6QuMJWyD+HH9S2+VEHor
-9NKDfKNo8AP6Jdx1fUJUk53uZpcg/Lxg+g084QWcaOelNM6R4mq2WEUuueUgDc2B
-yseJxARLMawmWrnX0uOuLgECgYBh1Y2PX2sn1kEVY1GE0aDAsjxz1EAmgx8ul0EV
-JI+EMIzj+Guw+EnNY1Yfd4/rsAelyuCHIT4Yj0HSfjfcPpUfo9NVOBIALj5nmN9h
-WTq9FI18+t0I756PTeAPVp141gg/dq/aeL1gc0VhNjZhMg9Wr2AiQL4R6IBliKnf
-uWnZLwKBgHfyg1w+dEUN/WDqJiRAxXkssgACrndXn/2eWbntKOkyO7Ux2HOTPtwg
-EofsDDa6Ltln9irqhbsjj2HLCWhF33OioqtWjWYfw66swfmH7qM/iZ+6pTKnsqdx
-VvtEEP0chZPhJI6CLIfIBQ3CDdBSrY1RY1E6b7csYQz9jfU6aq5T
------END RSA PRIVATE KEY-----
diff --git a/tests/mosquitto/server.pem b/tests/mosquitto/server.pem
deleted file mode 100644
index 302a451..0000000
--- a/tests/mosquitto/server.pem
+++ /dev/null
@@ -1,16 +0,0 @@
------BEGIN CERTIFICATE-----
-MIICfjCCAecCCQC25uKBpE2iKjANBgkqhkiG9w0BAQUFADBDMQswCQYDVQQGEwJK
-UDETMBEGA1UECBMKU29tZS1TdGF0ZTEQMA4GA1UEChMHU29tZU9yZzENMAsGA1UE
-AxMEcm9vdDAeFw0xNTExMTYwODA1MDBaFw0yNTExMTMwODA1MDBaMEAxCzAJBgNV
-BAYTAkpQMRMwEQYDVQQIEwpTb21lLVN0YXRlMRAwDgYDVQQKEwdTb21lT3JnMQow
-CAYDVQQDFAEqMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtxe6C/ex
-qEp8MlrtxTWRqSUIS4XBz6oEp+7R/pnOq3LmCM6GiKG/QNCptSgtYOV8xPQ0Zs58
-Bg1chrS267WrhC8VbXiYhEljim90/w/fGstPXBE8/hBw2lJlZCrnkMmZFFU4CX9L
-/5/qElxeOAgGWBZvPdNfapOpbdlxA/SNqwl5fp4A0Gjdxy3B8sxHzUpBKl19EeFu
-lKI7qArtu4fKQntTxMLgczDNjXE14Omm3cU0U1Mta9NjyENm6UUZecxsCWM6LMNi
-83wjb8utibzGsbFuGmYcSoRSfNVOrlwo9vm0iDNesRsmeQ+MefKjtvTHEGUln1AI
-ZITqcJFfZUxwGwIDAQABMA0GCSqGSIb3DQEBBQUAA4GBAKEE6zsYjrvl4MTAyx7f
-aV0upT+aqHaxBUPH4RkhHxWOqz6Ov9Xk06rafPh0ujry5IMPyFJ9Hi9UrFHoOMtB
-UUtdWe6whJUZhRSj+HSak1yCverLC/10jHfcqo2KnBrY1h+RIY2LcmspRayxe+Yj
-FAIihOL+maxgu5vlrrE3fmjG
------END CERTIFICATE-----
diff --git a/tests/retain_test.go b/tests/retain_test.go
deleted file mode 100644
index a85efc8..0000000
--- a/tests/retain_test.go
+++ /dev/null
@@ -1,225 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"fmt"
-	"testing"
-	"time"
-
-	MQTT "github.com/eclipse/paho.mqtt.golang"
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji"
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/device"
-	"github.com/shiguredo/fuji/gateway"
-)
-
-// TestRetainJustPublish tests
-// 1. connect gateway to local broker
-// 2. send data with retaind flag dummy device normaly
-func TestRetainJustPublish(t *testing.T) {
-	assert := assert.New(t)
-
-	configStr := `
-	[gateway]
-	
-	    name = "retainham"
-	
-	[[broker."local/1"]]
-	
-	    host = "localhost"
-	    port = 1883
-	
-	[device."doraretain"]
-	
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	
-	    interval = 10
-	    payload = "Hello world retain true."
-	    retain = true
-`
-
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-
-	commandChannel := make(chan string)
-	go fuji.StartByFileWithChannel(conf, commandChannel)
-
-	time.Sleep(2 * time.Second)
-}
-
-// TestRetainSubscribePublishClose
-// 1. connect gateway to local broker
-// 2. send data with retaind flag from dummy device
-// 3. disconnect
-// 4. reconnect
-// 5. subscirbe and receive data
-func TestRetainSubscribePublishClose(t *testing.T) {
-	assert := assert.New(t)
-	configStr := `
-	[gateway]
-	
-	    name = "testRetainafterclose"
-	
-	[[broker."local/1"]]
-	
-	    host = "localhost"
-	    port = 1883
-	
-	[device."dora"]
-	
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	
-	    interval = 10
-	    payload = "Hello retained world to subscriber after close."
-	
-	    retain = true
-`
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-	isRetain := true
-	generalPubSubTest(t, conf, isRetain)
-}
-
-// TestNoRetainSubscribePublishClose
-// 1. connect gateway to local broker
-// 2. send data without retaind flag from dummy device
-// 3. disconnect
-// 4. reconnect
-// 5. subscirbe and receive data
-func TestNoRetainSubscribePublishClose(t *testing.T) {
-	assert := assert.New(t)
-	configStr := `
-	[gateway]
-	
-	    name = "testNoRetainafterclose"
-	
-	[[broker."local/1"]]
-	
-	    host = "localhost"
-	    port = 1883
-	
-	[device."dora"]
-	
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	
-	    interval = 10
-	    payload = "Hello retained world to subscriber after close."
-`
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-	isRetain := false
-	generalPubSubTest(t, conf, isRetain)
-}
-
-func generalPubSubTest(t *testing.T, conf config.Config, isRetain bool) {
-	assert := assert.New(t)
-
-	commandChannel := make(chan string)
-	go fuji.StartByFileWithChannel(conf, commandChannel)
-
-	gw, err := gateway.NewGateway(conf)
-	if err != nil {
-		t.Error("Cannot make Gateway")
-	}
-
-	brokerList, err := broker.NewBrokers(conf, gw.BrokerChan)
-	if err != nil {
-		t.Error("Cannot make BrokerList")
-	}
-
-	devChan := device.NewDeviceChannel()
-	gw.DeviceChannels = append(gw.DeviceChannels, devChan)
-	dummyDevice, err := device.NewDummyDevice(conf.Sections[2], brokerList, devChan)
-	if err != nil {
-		t.Error("Cannot make DummyDeviceList")
-	}
-
-	go func() {
-		time.Sleep(2 * time.Second)
-
-		// kill publisher
-		gw.Stop()
-
-		time.Sleep(2 * time.Second)
-
-		subscriberChannel, err := setupRetainSubscriber(gw, brokerList[0], &dummyDevice)
-		if err != config.Error("") {
-			t.Error(err)
-		}
-
-		// check Retained message
-		select {
-		case retainedMessage := <-subscriberChannel:
-			if !isRetain {
-				assert.Equal("retained message arrived", "no retain message shall come")
-			}
-			retainedTopic := retainedMessage[0]
-			retainedPayload := retainedMessage[1]
-
-			expectedTopic := fmt.Sprintf("%s/%s/%s/%s/publish", brokerList[0].TopicPrefix, gw.Name, dummyDevice.Name, dummyDevice.Type)
-			expectedPayload := dummyDevice.Payload
-
-			assert.Equal(expectedTopic, retainedTopic)
-			assert.Equal(expectedPayload, retainedPayload)
-
-		case <-time.After(time.Second * 2):
-			if isRetain {
-				assert.Equal("subscribe completed in 11 sec", "not completed")
-			}
-		}
-	}()
-	time.Sleep(5 * time.Second)
-}
-
-// setupRetainSubscriber returnes channel in order to read messages with retained flag
-func setupRetainSubscriber(gw *gateway.Gateway, broker *broker.Broker, dummyDevice *device.DummyDevice) (chan [2]string, config.Error) {
-	// Setup MQTT pub/sub client to confirm published content.
-	//
-	messageOutputChannel := make(chan [2]string)
-
-	opts := MQTT.NewClientOptions()
-	brokerUrl := fmt.Sprintf("tcp://%s:%d", broker.Host, broker.Port)
-	opts.AddBroker(brokerUrl)
-	opts.SetClientID(gw.Name + "testSubscriber") // to distinguish MQTT client from publisher
-	opts.SetCleanSession(false)
-	opts.SetDefaultPublishHandler(func(client *MQTT.Client, msg MQTT.Message) {
-		messageOutputChannel <- [2]string{msg.Topic(), string(msg.Payload())}
-	})
-
-	client := MQTT.NewClient(opts)
-	if client == nil {
-		return nil, config.Error("NewClient failed")
-	}
-
-	if token := client.Connect(); token.Wait() && token.Error() != nil {
-		return nil, config.Error(fmt.Sprintf("NewClient Start failed %q", token.Error()))
-	}
-	qos := 0
-	retainedTopic := fmt.Sprintf("%s/%s/%s/%s/publish", broker.TopicPrefix, gw.Name, dummyDevice.Name, dummyDevice.Type)
-	client.Subscribe(retainedTopic, byte(qos), func(client *MQTT.Client, msg MQTT.Message) {
-	})
-
-	return messageOutputChannel, config.Error("")
-}
diff --git a/tests/testing_conf.toml b/tests/testing_conf.toml
deleted file mode 100644
index 48e9026..0000000
--- a/tests/testing_conf.toml
+++ /dev/null
@@ -1,66 +0,0 @@
-[gateway]
-
-    name = "ham"
-    max_retry_count = 30
-
-[[broker."sango/1"]]
-
-    host = "192.0.2.10"
-    port = 1883
-
-    username = "fuji-gw"
-    password = "123"
-
-    topic_prefix = "fuji-gw@example.com"
-    retry_interval = 10
-
-
-[[broker."sango/2"]]
-
-    host = "192.0.2.11"
-    port = 1883
-
-    username = "fuji-gw"
-    password = 123
-
-    topic_prefix = "fuji-gw@example.com"
-    retry_interval = 10
-
-[[broker."akane"]]
-
-    host = "192.0.2.20"
-    port = 8883
-    tls = true
-    cacert = "mosquitto/ca.pem"
-
-    username = "fuji-gw"
-    password = 456
-
-[device."spam"]
-
-    type = "serial"
-    broker = "sango"
-    qos = 0
-
-    serial = "/dev/tty.ble"
-    baud = 9600
-    size = 4
-
-[device."beacon"]
-
-    type = "serial"
-    broker = "sango"
-    qos = 2
-
-    serial = "/dev/tty.enocean"
-    baud = 115200
-    size = 8
-
-[device."dora"]
-
-    type = "dummy"
-    broker = "sango"
-    qos = 2
-
-    interval = 10
-    payload = "Hello world."
diff --git a/tests/tls_clientcert_test.go b/tests/tls_clientcert_test.go
deleted file mode 100644
index 8a7acc6..0000000
--- a/tests/tls_clientcert_test.go
+++ /dev/null
@@ -1,138 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"fmt"
-	"testing"
-	"time"
-
-	MQTT "github.com/eclipse/paho.mqtt.golang"
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji"
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/device"
-	"github.com/shiguredo/fuji/gateway"
-)
-
-var tlsClientCertconfigStr = `
-[gateway]
-
-    name = "tlsccerthamlocalconnect"
-
-[[broker."mosquitto/1"]]
-
-    host = "localhost"
-    port = 9883
-    tls = true
-    cacert = "mosquitto/ca.pem"
-    client_cert = "mosquitto/client.pem"
-    client_key = "mosquitto/client.key"
-
-    retry_interval = 10
-
-
-[device."dora"]
-    type = "dummy"
-
-    broker = "mosquitto"
-    qos = 0
-
-    interval = 10
-    payload = "connect local pub only Hello world."
-`
-
-// TestTLSConnectLocalPub
-func TestTLSClientCertConnectLocalPub(t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfigByte([]byte(tlsClientCertconfigStr))
-	assert.Nil(err)
-	commandChannel := make(chan string)
-	go fuji.StartByFileWithChannel(conf, commandChannel)
-	time.Sleep(2 * time.Second)
-
-}
-
-// TestTLSConnectLocalPubSub
-// 1. connect gateway to local broker with TLS
-// 2. send data from dummy
-// 3. check subscribe
-func TestTLSClientCertConnectLocalPubSub(t *testing.T) {
-	assert := assert.New(t)
-
-	// pub/sub test to broker on localhost
-	// dummydevice is used as a source of published message
-	// publised messages confirmed by subscriber
-
-	// get config
-	conf, err := config.LoadConfigByte([]byte(tlsClientCertconfigStr))
-	assert.Nil(err)
-
-	// get Gateway
-	gw, err := gateway.NewGateway(conf)
-	assert.Nil(err)
-
-	// get Broker
-	brokerList, err := broker.NewBrokers(conf, gw.BrokerChan)
-	assert.Nil(err)
-
-	// get DummyDevice
-	dummyDevice, err := device.NewDummyDevice(conf.Sections[2], brokerList, device.NewDeviceChannel())
-	assert.Nil(err)
-	assert.NotNil(dummyDevice)
-
-	// Setup MQTT pub/sub client to confirm published content.
-	//
-	subscriberChannel := make(chan [2]string)
-
-	opts := MQTT.NewClientOptions()
-	url := fmt.Sprintf("ssl://%s:%d", brokerList[0].Host, brokerList[0].Port)
-	opts.AddBroker(url)
-	opts.SetClientID(fmt.Sprintf("prefix%s", gw.Name))
-	opts.SetCleanSession(false)
-
-	tlsConfig, err := broker.NewTLSConfig(brokerList[0])
-	assert.Nil(err)
-	opts.SetTLSConfig(tlsConfig)
-
-	client := MQTT.NewClient(opts)
-	assert.Nil(err)
-	if token := client.Connect(); token.Wait() && token.Error() != nil {
-		assert.Nil(token.Error())
-		t.Log(token.Error())
-	}
-
-	qos := 0
-	expectedTopic := fmt.Sprintf("/%s/%s/%s/publish", gw.Name, dummyDevice.Name, dummyDevice.Type)
-	expectedMessage := fmt.Sprintf("%s", dummyDevice.Payload)
-	t.Logf("expetcted topic: %s\nexpected message%s", expectedTopic, expectedMessage)
-	client.Subscribe(expectedTopic, byte(qos), func(client *MQTT.Client, msg MQTT.Message) {
-		subscriberChannel <- [2]string{msg.Topic(), string(msg.Payload())}
-	})
-
-	// wait for 1 publication of dummy worker
-	select {
-	case message := <-subscriberChannel:
-		assert.Equal(expectedTopic, message[0])
-		assert.Equal(expectedMessage, message[1])
-	case <-time.After(time.Second * 11):
-		assert.Equal("subscribe completed in 11 sec", "not completed")
-	}
-
-	client.Disconnect(20)
-}
diff --git a/tests/tls_connect_test.go b/tests/tls_connect_test.go
deleted file mode 100644
index a17cf7b..0000000
--- a/tests/tls_connect_test.go
+++ /dev/null
@@ -1,136 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"fmt"
-	"testing"
-	"time"
-
-	MQTT "github.com/eclipse/paho.mqtt.golang"
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji"
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/device"
-	"github.com/shiguredo/fuji/gateway"
-)
-
-var configStr = `
-[gateway]
-
-    name = "hamlocalconnect"
-
-[[broker."mosquitto/1"]]
-
-    host = "localhost"
-    port = 8883
-    tls = true
-    cacert = "mosquitto/ca.pem"
-
-    retry_interval = 10
-
-
-[device."dora"]
-    type = "dummy"
-
-    broker = "mosquitto"
-    qos = 0
-
-    interval = 10
-    payload = "connect local pub only Hello world."
-`
-
-// TestTLSConnectLocalPub
-func TestTLSConnectLocalPub(t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-	commandChannel := make(chan string)
-	go fuji.StartByFileWithChannel(conf, commandChannel)
-	time.Sleep(2 * time.Second)
-
-}
-
-// TestTLSConnectLocalPubSub
-// 1. connect gateway to local broker with TLS
-// 2. send data from dummy
-// 3. check subscribe
-func TestTLSConnectLocalPubSub(t *testing.T) {
-	assert := assert.New(t)
-
-	// pub/sub test to broker on localhost
-	// dummydevice is used as a source of published message
-	// publised messages confirmed by subscriber
-
-	// get config
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-
-	// get Gateway
-	gw, err := gateway.NewGateway(conf)
-	assert.Nil(err)
-
-	// get Broker
-	brokerList, err := broker.NewBrokers(conf, gw.BrokerChan)
-	assert.Nil(err)
-
-	// get DummyDevice
-	dummyDevice, err := device.NewDummyDevice(conf.Sections[2], brokerList, device.NewDeviceChannel())
-	assert.Nil(err)
-	assert.NotNil(dummyDevice)
-
-	// Setup MQTT pub/sub client to confirm published content.
-	//
-	subscriberChannel := make(chan [2]string)
-
-	opts := MQTT.NewClientOptions()
-	url := fmt.Sprintf("ssl://%s:%d", brokerList[0].Host, brokerList[0].Port)
-	opts.AddBroker(url)
-	opts.SetClientID(fmt.Sprintf("prefix%s", gw.Name))
-	opts.SetCleanSession(false)
-
-	tlsConfig, err := broker.NewTLSConfig(brokerList[0])
-	assert.Nil(err)
-	opts.SetTLSConfig(tlsConfig)
-
-	client := MQTT.NewClient(opts)
-	assert.Nil(err)
-	if token := client.Connect(); token.Wait() && token.Error() != nil {
-		assert.Nil(token.Error())
-		t.Log(token.Error())
-	}
-
-	qos := 0
-	expectedTopic := fmt.Sprintf("/%s/%s/%s/publish", gw.Name, dummyDevice.Name, dummyDevice.Type)
-	expectedMessage := fmt.Sprintf("%s", dummyDevice.Payload)
-	t.Logf("expetcted topic: %s\nexpected message%s", expectedTopic, expectedMessage)
-	client.Subscribe(expectedTopic, byte(qos), func(client *MQTT.Client, msg MQTT.Message) {
-		subscriberChannel <- [2]string{msg.Topic(), string(msg.Payload())}
-	})
-
-	// wait for 1 publication of dummy worker
-	select {
-	case message := <-subscriberChannel:
-		assert.Equal(expectedTopic, message[0])
-		assert.Equal(expectedMessage, message[1])
-	case <-time.After(time.Second * 11):
-		assert.Equal("subscribe completed in 11 sec", "not completed")
-	}
-
-	client.Disconnect(20)
-}
diff --git a/tests/toml_retain_test.go b/tests/toml_retain_test.go
deleted file mode 100644
index 81a92df..0000000
--- a/tests/toml_retain_test.go
+++ /dev/null
@@ -1,192 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/device"
-	"github.com/shiguredo/fuji/message"
-)
-
-// configRetainTestCase indicates a condition for testing Retain.
-// configString is the body of configuration file.
-// expectedError is the expected error state when the test is executed.
-// message is the detail of test failure.
-type configRetainTestCase struct {
-	configStr     string
-	expectedError config.AnyError
-	message       string
-}
-
-var serialDeviceTestcases = []configRetainTestCase{
-	// check device validation without retain flag
-	{
-		configStr: `
-		[[broker."sango/1"]]
-		host = "localhost"
-		port = 1883
-
-		[device."hi"]
-		type = "serial"
-		broker = "sango"
-		serial = "/dev/tty"
-		baud = 9600
-		qos = 0
-`,
-		expectedError: nil,
-		message:       "Retain flag could not be omitted. Shall be optional."},
-	// check device validation with retain flag
-	{
-		configStr: `
-		[[broker."sango/1"]]
-		host = "localhost"
-		port = 1883
-
-		[device."hi"]
-		type = "serial"
-		broker = "sango"
-		serial = "/dev/tty"
-		baud = 9600
-		qos = 0
-		retain = true
-`,
-		expectedError: nil,
-		message:       "Retain flag could not be set."},
-	// check device validation with retain flag is false
-	{
-		configStr: `
-		[[broker."sango/1"]]
-		host = "localhost"
-		port = 1883
-
-		[device."hi"]
-		type = "serial"
-		broker = "sango"
-		serial = "/dev/tty"
-		baud = 9600
-		qos = 0
-		retain = false 
-`,
-		expectedError: nil,
-		message:       "Retain flag could not be un-set."},
-}
-
-var dummyDeviceTestcases = []configRetainTestCase{
-	// check device validation without retain flag
-	{
-		configStr: `
-		[[broker."sango/1"]]
-		host = "localhost"
-		port = 1883
-
-		[device."hi"]
-		type = "dummy"
-		broker = "sango"
-		qos = 0
-		interval = 10
-		payload = "Hello world."
-`,
-		expectedError: nil,
-		message:       "Retain flag could not be omitted. Shall be optional."},
-	// check device validation with retain flag
-	{
-		configStr: `
-		[[broker."sango/1"]]
-		host = "localhost"
-		port = 1883
-
-		[device."hi"]
-		type = "dummy"
-		broker = "sango"
-		qos = 0
-		retain = true
-		interval = 10
-		payload = "Hello world."
-`,
-		expectedError: nil,
-		message:       "Retain flag could not be set."},
-	// check device validation with retain flag is false
-	{
-		configStr: `
-		[[broker."sango/1"]]
-		host = "localhost"
-		port = 1883
-
-                [device."hi"]
-		type = "dummy"
-		broker = "sango"
-		qos = 0
-		retain = false 
-		interval = 10
-		payload = "Hello world."
-`,
-		expectedError: nil,
-		message:       "Retain flag could not be un-set."},
-}
-
-// generalConfigRetainSerialDeviceTest checks retain function with serial device
-func generalConfigRetainSerialDeviceTest(test configRetainTestCase, t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfigByte([]byte(test.configStr))
-	assert.Nil(err)
-
-	brokers, err := broker.NewBrokers(conf, make(chan message.Message))
-	assert.Nil(err)
-
-	devices, _, err := device.NewDevices(conf, brokers)
-	assert.Nil(err)
-	assert.Equal(1, len(devices))
-}
-
-// generalConfigRetainDummyDeviceTest checks retain function with dummy device
-func generalConfigRetainDummyDeviceTest(test configRetainTestCase, t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfigByte([]byte(test.configStr))
-	assert.Nil(err)
-
-	brokers, err := broker.NewBrokers(conf, make(chan message.Message))
-	assert.Nil(err)
-
-	dummy, err := device.NewDummyDevice(conf.Sections[1], brokers, device.NewDeviceChannel())
-	if test.expectedError == nil {
-		assert.Nil(err)
-		assert.NotNil(dummy)
-	} else {
-		assert.NotNil(err)
-	}
-}
-
-// TestConfigRetainDeviceAll tests a serial device using test code
-func TestConfigRetainDeviceAll(t *testing.T) {
-	i := 0
-	for _, testcase := range serialDeviceTestcases {
-		generalConfigRetainSerialDeviceTest(testcase, t)
-		i++
-	}
-}
-
-// TestConfigRetainDeviceAll tests a dummy device using test code
-func TestConfigRetainDummyDeviceAll(t *testing.T) {
-	for _, testcase := range dummyDeviceTestcases {
-		generalConfigRetainDummyDeviceTest(testcase, t)
-	}
-}
diff --git a/tests/toml_test.go b/tests/toml_test.go
deleted file mode 100644
index fa500b5..0000000
--- a/tests/toml_test.go
+++ /dev/null
@@ -1,81 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/device"
-	"github.com/shiguredo/fuji/gateway"
-	"github.com/shiguredo/fuji/message"
-)
-
-func TestLoadConfig(t *testing.T) {
-	assert := assert.New(t)
-
-	_, err := config.LoadConfig("testing_conf.toml")
-	assert.Nil(err)
-}
-
-func TestNewGateway(t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfig("testing_conf.toml")
-	assert.Nil(err)
-	gw, err := gateway.NewGateway(conf)
-	assert.Nil(err)
-	assert.Equal("ham", gw.Name)
-}
-
-func TestNewBrokers(t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfig("testing_conf.toml")
-	assert.Nil(err)
-	brokerList, err := broker.NewBrokers(conf, make(chan message.Message))
-	assert.Nil(err)
-	assert.Equal(3, len(brokerList))
-}
-
-func TestNewSerialDevices(t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfig("testing_conf.toml")
-	brokerList, err := broker.NewBrokers(conf, make(chan message.Message))
-	assert.Nil(err)
-	deviceList, _, err := device.NewDevices(conf, brokerList)
-	assert.Nil(err)
-	assert.Equal(3, len(deviceList))
-}
-
-func TestNewDummyDevice(t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfig("testing_conf.toml")
-	brokerList, err := broker.NewBrokers(conf, make(chan message.Message))
-	assert.Nil(err)
-
-	section := config.SearchDeviceType(&conf.Sections, "dummy")
-	assert.NotNil(section)
-
-	dummy, err := device.NewDummyDevice(*section, brokerList, device.NewDeviceChannel())
-	assert.Nil(err)
-	assert.Equal("dummy", dummy.DeviceType())
-	assert.Equal(2, int(dummy.QoS))
-}
diff --git a/tests/toml_will_test.go b/tests/toml_will_test.go
deleted file mode 100644
index bc10c49..0000000
--- a/tests/toml_will_test.go
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"testing"
-
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/message"
-)
-
-type configWillTestCase struct {
-	configStr     string          // testcase config file
-	expectedError config.AnyError // expected error status
-	message       string          // message when failed
-}
-
-var testcases = []configWillTestCase{
-	// tests broker validation without will_message
-	{
-		configStr: `
-                [[broker."sango/1"]]
-
-                    host = "localhost"
-                    port = 1883
-`,
-		expectedError: nil,
-		message:       "WillMessage could not be omitted. Shall be optional."},
-	// tests broker validation with will_message
-	{
-		configStr: `
-                [[broker."sango/1"]]
-
-                    host = "localhost"
-                    port = 1883
-		    will_message = "Hello world."
-`,
-		expectedError: nil,
-		message:       "WillMessage could not be defined."},
-	// tests broker validation with empty will_message
-	{
-		configStr: `
-                [[broker."sango/1"]]
-
-                    host = "localhost"
-                    port = 1883
-		    will_message = ""
-`,
-		expectedError: nil,
-		message:       "Empty WillMessage could not be defined."},
-	// tests multiple broker validation with only one will_message
-	{
-		configStr: `
-                [[broker."sango/1"]]
-
-                    host = "localhost"
-                    port = 1883
-
-                [[broker."sango/2"]]
-
-                    host = "192.168.1.1 "
-                    port = 1883
-		    will_message = "Hello world."
-`,
-		expectedError: nil,
-		message:       "WillMessage could not be defined for one of two."},
-	// tests multiple broker validation with both will_message
-	{
-		configStr: `
-                [[broker."sango/1"]]
-
-                    host = "localhost"
-                    port = 1883
-		    will_message = "Change the world."
-
-                [[broker."sango/2"]]
-
-                    host = "192.168.1.1"
-                    port = 1883
-		    will_message = "Hello world."
-`,
-		expectedError: nil,
-		message:       "WillMessage could not be defined for both of two."},
-}
-
-func generalConfigWillTest(test configWillTestCase, t *testing.T) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfigByte([]byte(test.configStr))
-	assert.Nil(err)
-
-	brokers, err := broker.NewBrokers(conf, make(chan message.Message))
-	assert.Nil(err)
-	assert.NotEqual(0, len(brokers))
-}
-
-func TestConfigWillAll(t *testing.T) {
-	for _, testcase := range testcases {
-		generalConfigWillTest(testcase, t)
-	}
-}
diff --git a/tests/will_test.go b/tests/will_test.go
deleted file mode 100644
index cb87e81..0000000
--- a/tests/will_test.go
+++ /dev/null
@@ -1,345 +0,0 @@
-// Copyright 2015-2016 Shiguredo Inc. <fuji@shiguredo.jp>
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-//    http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-package main
-
-import (
-	"fmt"
-	"os"
-	"os/exec"
-	"path/filepath"
-	"testing"
-	"time"
-
-	MQTT "github.com/eclipse/paho.mqtt.golang"
-	"github.com/stretchr/testify/assert"
-
-	"github.com/shiguredo/fuji"
-	"github.com/shiguredo/fuji/broker"
-	"github.com/shiguredo/fuji/config"
-	"github.com/shiguredo/fuji/gateway"
-)
-
-var tmpTomlName = ".tmp.toml"
-
-// TestWillJustPublish tests
-// 1. connect localhost broker with will message
-// 2. send data from a dummy device
-// 3. disconnect
-func TestWillJustPublish(t *testing.T) {
-	assert := assert.New(t)
-
-	configStr := `
-	[gateway]
-	    name = "willjustpublishham"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = "no letter is good letter."
-	[device."dora"]
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	    interval = 10
-	    payload = "Hello will just publish world."
-`
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-	commandChannel := make(chan string)
-	go fuji.StartByFileWithChannel(conf, commandChannel)
-	time.Sleep(5 * time.Second)
-
-	//	fuji.Stop()
-}
-
-// TestWillWithPrefixSubscribePublishClose
-// 1. connect subscriber and publisher to localhost broker with will message with prefixed topic
-// 2. send data from a dummy device
-// 3. force disconnect
-// 4. check subscriber does not receives will message immediately
-func TestWillWithPrefixSubscribePublishClose(t *testing.T) {
-	assert := assert.New(t)
-
-	configStr := `
-	[gateway]
-	    name = "testprefixwill"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = "no letter is good letter."
-	    topic_prefix = "prefix"
-	[device."dora"]
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	    interval = 10
-	    payload = "Hello will with prefix."
-`
-	expectedWill := true
-	ok := genericWillTestDriver(t, configStr, "prefix/testprefixwill/will", []byte("no letter is good letter."), expectedWill)
-	assert.True(ok, "Failed to receive Will with prefix message")
-}
-
-// TestNoWillSubscribePublishClose
-// 1. connect subscriber and publisher to localhost broker without will message
-// 2. send data from a dummy device
-// 3. force disconnect
-// 4. check subscriber does not receives will message immediately
-func TestNoWillSubscribePublishClose(t *testing.T) {
-	assert := assert.New(t)
-
-	configStr := `
-	[gateway]
-	    name = "testnowillafterclose"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	[device."dora"]
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	    interval = 10
-	    payload = "Hello will just publish world."
-`
-	expectedWill := false
-	ok := genericWillTestDriver(t, configStr, "/testnowillafterclose/will", []byte(""), expectedWill)
-	assert.False(ok, "Failed to receive Will message")
-}
-
-// TestWillSubscribePublishClose
-// 1. connect subscriber and publisher to localhost broker with will message
-// 2. send data from a dummy device
-// 3. force disconnect
-// 4. check subscriber receives will message
-func TestWillSubscribePublishClose(t *testing.T) {
-	assert := assert.New(t)
-
-	configStr := `
-	[gateway]
-	    name = "testwillafterclose"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = "good letter is no letter."
-	[device."dora"]
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	    interval = 10
-	    payload = "Hello will just publish world."
-`
-	expectedWill := true
-	ok := genericWillTestDriver(t, configStr, "/testwillafterclose/will", []byte("good letter is no letter."), expectedWill)
-	assert.True(ok, "Failed to receive Will message")
-}
-
-// TestWillSubscribePublishCloseEmpty
-// 1. connect subscriber and publisher to localhost broker with will message
-// 2. send data from a dummy device
-// 3. force disconnect
-// 4. check subscriber receives will message
-func TestWillSubscribePublishCloseEmpty(t *testing.T) {
-	configStr := `
-	[gateway]
-	    name = "testwillaftercloseemptywill"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = ""
-	[device."dora"]
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	    interval = 10
-	    payload = "Hello will just publish world."
-`
-	expectedWill := true
-	ok := genericWillTestDriver(t, configStr, "/testwillaftercloseemptywill/will", []byte{}, expectedWill)
-	if !ok {
-		t.Error("Failed to receive Empty Will message")
-	}
-}
-
-func TestWillSubscribePublishBinaryWill(t *testing.T) {
-	configStr := `
-	[gateway]
-	    name = "binary"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = "\\x01\\x02"
-	[device."dora"]
-	    type = "dummy"
-	    broker = "local"
-	    qos = 0
-	    interval = 10
-	    payload = "Hello will just publish world."
-`
-	expectedWill := true
-	ok := genericWillTestDriver(t, configStr, "/binary/will", []byte{1, 2}, expectedWill)
-	if !ok {
-		t.Error("Failed to receive Empty Will message")
-	}
-}
-
-func TestWillSubscribePublishWillWithWillTopic(t *testing.T) {
-	configStr := `
-	[gateway]
-	    name = "with"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = "msg"
-	    will_topic = "willtopic"
-`
-	expectedWill := true
-	ok := genericWillTestDriver(t, configStr, "/willtopic", []byte("msg"), expectedWill)
-	if !ok {
-		t.Error("Failed to receive Empty Will message")
-	}
-}
-
-func TestWillSubscribePublishWillWithNestedWillTopic(t *testing.T) {
-	configStr := `
-	[gateway]
-	    name = "withnested"
-	[[broker."local/1"]]
-	    host = "localhost"
-	    port = 1883
-	    will_message = "msg"
-	    will_topic = "willtopic/nested"
-`
-	expectedWill := true
-	ok := genericWillTestDriver(t, configStr, "/willtopic/nested", []byte("msg"), expectedWill)
-	if !ok {
-		t.Error("Failed to receive nested willtopic Will message")
-	}
-}
-
-// genericWillTestDriver
-// 1. read config string
-// 2. connect subscriber and publisher to localhost broker with will message
-// 3. send data from a dummy device
-// 4. force disconnect
-// 5. check subscriber receives will message
-
-func genericWillTestDriver(t *testing.T, configStr string, expectedTopic string, expectedPayload []byte, expectedWill bool) (ok bool) {
-	assert := assert.New(t)
-
-	conf, err := config.LoadConfigByte([]byte(configStr))
-	assert.Nil(err)
-
-	// write config string to temporal file
-	f, err := os.Create(tmpTomlName)
-	if err != nil {
-		t.Error(err)
-	}
-	_, err = f.WriteString(configStr)
-	if err != nil {
-		t.Error(err)
-	}
-	f.Sync()
-
-	// execute fuji as external process
-	fujiPath, err := filepath.Abs("../fuji")
-	if err != nil {
-		t.Error("file path not found")
-	}
-	cmd := exec.Command(fujiPath, "-c", tmpTomlName)
-	err = cmd.Start()
-	if err != nil {
-		t.Error(err)
-	}
-
-	// subscriber setup
-	gw, err := gateway.NewGateway(conf)
-	assert.Nil(err)
-
-	brokers, err := broker.NewBrokers(conf, gw.BrokerChan)
-	assert.Nil(err)
-
-	subscriberChannel, err := setupWillSubscriber(gw, brokers[0], t)
-	if err != config.Error("") {
-		t.Error(err)
-	}
-
-	fin := make(chan bool)
-
-	go func() {
-		// check will message
-		willCame := true
-		select {
-		case willMsg := <-subscriberChannel:
-			if expectedWill {
-				assert.Equal(expectedTopic, willMsg.Topic())
-				assert.Equal(expectedPayload, willMsg.Payload())
-				assert.Equal(byte(0), willMsg.Qos())
-			} else {
-				assert.Equal("NO will message received within 1 sec", "unexpected will message received.")
-			}
-		case <-time.After(time.Second * 2):
-			if expectedWill {
-				assert.Equal("will message received within 1 sec", "not completed")
-			}
-			willCame = false
-		}
-		fin <- willCame
-	}()
-
-	// wait for startup of external command process
-	time.Sleep(time.Second * 1)
-
-	// kill publisher
-	err = cmd.Process.Kill()
-	if err != nil {
-		t.Error(err)
-	}
-	t.Log("broker killed for getting will message")
-
-	ok = <-fin
-	return ok
-}
-
-// setupWillSubscriber start subscriber process and returnes a channel witch can receive will message.
-func setupWillSubscriber(gw *gateway.Gateway, broker *broker.Broker, t *testing.T) (chan MQTT.Message, config.Error) {
-	// Setup MQTT pub/sub client to confirm published content.
-	//
-	messageOutputChannel := make(chan MQTT.Message)
-
-	opts := MQTT.NewClientOptions()
-	brokerUrl := fmt.Sprintf("tcp://%s:%d", broker.Host, broker.Port)
-	opts.AddBroker(brokerUrl)
-	opts.SetClientID(gw.Name + "testSubscriber") // to distinguish MQTT client from publisher
-	opts.SetCleanSession(false)
-	opts.SetDefaultPublishHandler(func(client *MQTT.Client, msg MQTT.Message) {
-		messageOutputChannel <- msg
-	})
-	willQoS := 0
-	willTopic := broker.WillTopic
-	t.Logf("expected will_topic: %s", willTopic)
-
-	client := MQTT.NewClient(opts)
-	if client == nil {
-		return nil, config.Error("NewClient failed")
-	}
-	if token := client.Connect(); token.Wait() && token.Error() != nil {
-		return nil, config.Error(fmt.Sprintf("NewClient Start failed %q", token.Error()))
-	}
-
-	client.Subscribe(willTopic, byte(willQoS), func(client *MQTT.Client, msg MQTT.Message) {
-		messageOutputChannel <- msg
-	})
-
-	return messageOutputChannel, config.Error("")
-}
