X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=test%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnectionTest.java;fp=test%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Ffcp%2FFcpConnectionTest.java;h=0000000000000000000000000000000000000000;hb=2c42498bf68c9dade64f4b66ce00e7983c59396f;hp=30da36b43badce010e8d0261f1801872c4c65477;hpb=3b447777684ea3d391310139d10a311815b31531;p=jFCPlib.git diff --git a/test/main/java/net/pterodactylus/fcp/FcpConnectionTest.java b/test/main/java/net/pterodactylus/fcp/FcpConnectionTest.java deleted file mode 100644 index 30da36b..0000000 --- a/test/main/java/net/pterodactylus/fcp/FcpConnectionTest.java +++ /dev/null @@ -1,67 +0,0 @@ -/* - * jFCPlib - FcpConnectionTest.java - - * Copyright © 2008 David Roden - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 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 General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. - */ - -package net.pterodactylus.fcp; - -import java.io.IOException; -import java.io.InputStream; - - -/** - * TODO - * @author David ‘Bombe’ Roden <bombe@freenetproject.org> - */ -public class FcpConnectionTest extends FcpAdapter { - - public static void main(String[] commandLine) throws IllegalStateException, IOException { - new FcpConnectionTest(); - } - - private FcpConnectionTest() throws IllegalStateException, IOException { - FcpConnection fcpConnection = new FcpConnection("wing"); - fcpConnection.addFcpListener(this); - fcpConnection.connect(); - ClientHello clientHello = new ClientHello("bug-test"); - fcpConnection.sendMessage(clientHello); - ClientGet clientGet = new ClientGet("KSK@gpl.txt", "test"); - fcpConnection.sendMessage(clientGet); - } - - /** - * {@inheritDoc} - */ - @Override - public void receivedAllData(FcpConnection fcpConnection, AllData allData) { - System.out.println("AllData"); - InputStream payloadInputStream = allData.getPayloadInputStream(); - int r = 0; - byte[] buffer = new byte[1024]; - try { - while ((r = payloadInputStream.read(buffer)) != -1) { - for (int i = 0; i < r; i++) { - System.out.print((char) buffer[i]); - } - } - } catch (IOException e) { - // TODO Auto-generated catch block - } - fcpConnection.close(); - } - -}