@SuppressWarnings({ "unchecked", "rawtypes" })
@Before
public void setup() throws Exception {
byte[] bytes = "foo".getBytes();
Session session = mock(Session.class);
when(this.sessionFactory.getSession()).thenReturn(session);
when(session.readRaw("/foo/bar.txt")).thenReturn(new ByteArrayInputStream(bytes));
when(session.readRaw("/foo/baz.txt")).thenReturn(new ByteArrayInputStream(bytes));
when(session.finalizeRaw()).thenReturn(true);
Object[] fileList = new FTPFile[2];
FTPFile file = new FTPFile();
file.setName("bar.txt");
fileList[0] = file;
file = new FTPFile();
file.setName("baz.txt");
fileList[1] = file;
when(session.list("/foo/")).thenReturn(fileList);
this.bus = new LocalMessageBus();
this.bus.setApplicationContext(BusTestUtils.MOCK_AC);
this.bus.bindRequestor("foo", this.requestsOut, this.repliesIn, null);
this.bus.bindReplier("foo", this.requestsIn, this.repliesOut, null);