import org.glite.lb.SSL;
import java.io.*;
+import java.net.Socket;
public class SSLServer {
public static void main(String[] args) {
try {
ssl.setProxy(args[0]);
- InputStream in = ssl.accept(Integer.parseInt(args[1]),100000);
+ Socket sock = ssl.accept(Integer.parseInt(args[1]),100000);
System.out.println("accept ok");
+ InputStream in = sock.getInputStream();
+ PrintStream out = new PrintStream(sock.getOutputStream(),false);
while (true) {
byte[] buf = new byte[1000];
int len = in.read(buf);
System.out.write(buf,0,len);
+ out.print("buzz off");
}
}
catch (Exception e) {
public String chooseClientAlias(String[] keyType, Principal[] issuers, Socket
socket) {
- System.out.println("MyX509KeyManager.chooseClientAlias()");
/*
+ System.out.println("MyX509KeyManager.chooseClientAlias()");
for (int i = 0; i < keyType.length; i++) {
System.out.println("MyX509KeyManager.chooseClientAlias() keyType[" + i +
"]=" + keyType[i]);
proxy = p;
}
- public PrintStream connect(String host,int port,int timeout) throws KeyStoreException,NoSuchAlgorithmException,KeyManagementException,SocketException,IOException {
+ public Socket connect(String host,int port,int timeout) throws KeyStoreException,NoSuchAlgorithmException,KeyManagementException,SocketException,IOException {
init_ctx();
throw new NullPointerException("null session");
}
- return new PrintStream(client.getOutputStream(),false);
+ return client;
+ //return new PrintStream(client.getOutputStream(),false);
}
- public InputStream accept(int port,int timeout)
+ public Socket accept(int port,int timeout)
throws KeyStoreException,IOException,SocketException,NoSuchAlgorithmException,KeyManagementException
{
SSLSocket conn = (SSLSocket) server.accept();
- return conn.getInputStream();
+ return conn;
}
public void close() throws IOException,SocketException {
import java.io.IOException;
import java.io.PrintStream;
import java.security.*;
+import java.net.Socket;
/**
* This class opens secure connection using SSLv3 and then sends message to set
SSL lbsock = new SSL();
lbsock.setProxy(keyStoreSender);
- PrintStream s = lbsock.connect(host,port,timeout);
+ Socket sock = lbsock.connect(host,port,timeout);
+ PrintStream s = new PrintStream(sock.getOutputStream(),false);
s.print(EDG_WLL_LOG_SOCKET_HEADER);