public void setSocketOption(byte option, int value) throws IllegalArgumentException, IOException {
        switch(option){
        case SocketConnection.DELAY:
            socket.setTcpNoDelay(option == 0);
            break;
        case SocketConnection.KEEPALIVE:
            socket.setKeepAlive(option != 0);
            break;
        case SocketConnection.LINGER:
            socket.setSoLinger(value != 0, value);
            break;
        case SocketConnection.RCVBUF:
            socket.setReceiveBufferSize(value);
            break;
        case SocketConnection.SNDBUF:
            socket.setSendBufferSize(value);
            break;
        default:
            throw new IllegalArgumentException();
        }
    }