com.sun.grizzly.filter
Interface Client

All Known Implementing Classes:
CustomProtocolClient

public interface Client

Client API for communicating with aServer.

Version:
1.0
Author:
John Vieten 16.09.2008

Method Summary
 RemoteCall callRemote()
          If callers want to make a method call to an server.
 void connect(InetSocketAddress address)
          Used to build up a connection to a server.
 void connect(InetSocketAddress address, InetSocketAddress proxy, String userAgent, String userName, String pass)
          Used to build up a connection to a server over an proxy.
 OutputStream getOutputStream()
           
 void onMessageError(String errorMsg)
          Gets called if some protocol sepecific error happens.
 void service(InputStream inputStream, OutputStream outputStream)
          An client can also be called by an server.
 void setIoExceptionHandler(IOExceptionHandler ioExceptionHandler)
           
 void start()
          Setup and starts the client
 void stop()
          Stops client
 

Method Detail

callRemote

RemoteCall callRemote()
                      throws IOException
If callers want to make a method call to an server.

Returns:
RemoteCall which gives caller a OutputStream for writing to server and an InputStream for getting the servers's reply
Throws:
IOException

getOutputStream

OutputStream getOutputStream()
Returns:
OutputStream for writing to server

service

void service(InputStream inputStream,
             OutputStream outputStream)
An client can also be called by an server.

Parameters:
inputStream - containing the server bytes
outputStream - client can reply to server's message

onMessageError

void onMessageError(String errorMsg)
Gets called if some protocol sepecific error happens.

Parameters:
errorMsg -

connect

void connect(InetSocketAddress address)
             throws IOException
Used to build up a connection to a server. Method start() must have been called before.

Parameters:
address - server address
Throws:
IOException

connect

void connect(InetSocketAddress address,
             InetSocketAddress proxy,
             String userAgent,
             String userName,
             String pass)
             throws IOException
Used to build up a connection to a server over an proxy. Method start() must have been called before.

Parameters:
address - server address
proxy - address
userAgent - proxy agent identifier
userName - if proxy needs authentification (otherwise null)
pass - if proxy needs authentification (otherwise null)
Throws:
IOException

start

void start()
           throws Exception
Setup and starts the client

Throws:
Exception

stop

void stop()
          throws Exception
Stops client

Throws:
Exception

setIoExceptionHandler

void setIoExceptionHandler(IOExceptionHandler ioExceptionHandler)


Copyright © 2012 Oracle Corporation. All Rights Reserved.