diff --git a/src/component/mod.rs b/src/component/mod.rs
new file mode 100644
index 0000000..cfd2dfa
--- /dev/null
+++ b/src/component/mod.rs
@@ -0,0 +1,34 @@
+// Copyright (C) 2022-2099 The crate authors.
+//
+// This program is free software: you can redistribute it and/or modify it
+// under the terms of the GNU Affero General Public License as published by the
+// Free Software Foundation, either version 3 of the License, or (at your
+// option) any later version.
+//
+// This program is distributed in the hope that it will be useful, but WITHOUT
+// ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+// FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License
+// for more details.
+//
+// You should have received a copy of the GNU Affero General Public License
+// along with this program. If not, see .
+
+#[cfg(test)]
+mod test;
+mod xmpp;
+
+use crate::error::Error;
+
+use async_trait::async_trait;
+use futures::Stream;
+use xmpp_parsers::Element;
+
+// Testable interface
+#[async_trait]
+pub trait ComponentTrait: Stream + Unpin {
+ async fn send_stanza + Send>(&mut self, el: E) -> Result<(), Error>;
+}
+
+#[cfg(test)]
+pub use crate::component::test::Component as TestComponent;
+pub use crate::component::xmpp::Component;
diff --git a/src/component.rs b/src/component/test.rs
similarity index 77%
rename from src/component.rs
rename to src/component/test.rs
index f134630..93b9ac5 100644
--- a/src/component.rs
+++ b/src/component/test.rs
@@ -13,86 +13,21 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see .
+use crate::component::ComponentTrait;
use crate::error::Error;
-#[cfg(test)]
use std::collections::VecDeque;
-#[cfg(test)]
use std::fmt;
use std::marker::Send;
-use std::ops::{Deref, DerefMut};
+use std::ops::Deref;
use std::pin::Pin;
use std::task::Context;
-#[cfg(test)]
use std::thread;
use async_trait::async_trait;
use futures::{task::Poll, Stream};
-use log::debug;
-use tokio_xmpp::Component as TokioXMPPComponent;
-use xmpp_parsers::Element;
-#[cfg(test)]
-use xmpp_parsers::{iq::Iq, message::Message, presence::Presence};
+use xmpp_parsers::{iq::Iq, message::Message, presence::Presence, Element};
-// Testable interface
-#[async_trait]
-pub trait ComponentTrait: Stream + Unpin {
- async fn send_stanza + Send>(&mut self, el: E) -> Result<(), Error>;
-}
-
-pub struct Component(TokioXMPPComponent);
-
-impl Stream for Component {
- type Item = Element;
-
- fn poll_next(mut self: Pin<&mut Self>, cx: &mut Context) -> Poll